| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081 |
- <?xml version="1.0" encoding="UTF-8"?>
- <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
- <mapper namespace="com.jt.cloud.module.system.dal.mysql.group.GroupMapper">
- <!--
- 一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
- 无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
- 代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
- 文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
- -->
- <select id="getWeather" resultType="com.jt.cloud.module.system.controller.admin.weather.vo.WeatherVO">
- SELECT
- id,
- city,
- adcode,
- weather,
- temperature,
- windpower,
- winddirection,
- latitude,
- longitude,
- weather_code as weatherCode
- <if test="lon != null and lon != '' ">
- , ST_Distance_Sphere(POINT(longitude, latitude), POINT(#{lon}, #{lat})) AS distance
- </if>
- FROM system_weather
- <where>
- <![CDATA[ create_time >= CURDATE() ]]> AND <![CDATA[create_time < DATE_ADD(CURDATE(), INTERVAL 1 DAY)]]>
- <if test="weatherCode != null and weatherCode != '' ">
- weather_code = #{weatherCode}
- </if>
- </where>
- <!-- 如果传了经纬度,才加距离过滤和排序100公里范围 -->
- <if test="lon != null and lon != ''">
- HAVING distance <= 100000
- ORDER BY distance
- </if>
- LIMIT 1
- </select>
- <insert id="insertWeather">
- INSERT INTO system_weather (
- id,
- city,
- adcode,
- weather,
- temperature,
- windpower,
- winddirection,
- latitude,
- longitude,
- weather_code
- ) VALUES (
- #{id},
- #{city},
- #{adcode},
- #{weather},
- #{temperature},
- #{windpower},
- #{winddirection},
- #{latitude},
- #{longitude},
- #{weatherCode}
- )
- </insert>
- <!-- <select id="queryUserByHr" resultType="java.util.Map">-->
- <!-- SELECT-->
- <!-- *-->
- <!-- FROM-->
- <!-- hr_employee-->
- <!-- </select>-->
- </mapper>
|