jinpengyong
2020-11-23 d3c68dd9fec28c76e0bb61879dffaa7b0ec1e690
src/main/resources/mapper/WeatherMapper.xml
@@ -1,7 +1,6 @@
<?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.moral.mapper.WeatherMapper">
    <cache/>
    <select id="getCityWeatherConfig" resultType="java.util.Map">
        select city_code AS cityCode,
@@ -116,11 +115,20 @@
        )
    </select>
    <select id="getSampleFromHistoryWeather" resultType="java.lang.String" useCache="true">
    <select id="getSampleFromHistoryWeather" resultType="java.lang.String">
        select DATE_FORMAT(time, #{typeFormat}) as time
        from history_weather_${timeUnits}
        <where>
            city_code=#{cityCode}
            <if test="windDir != null">
                and value->'$.windDir' = #{windDir}
            </if>
            <if test="windScale != null">
                and value->'$.windScale' = #{windScale}
            </if>
            <if test="condition == 0">
                and cast(value->'$.condition' as UNSIGNED integer) > #{score}
            </if>
@@ -160,10 +168,13 @@
                </foreach>
            </if>
            <if test="month != null">
                and DATE_FORMAT(time, '%m') = #{month}
            </if>
        </where>
    </select>
    <select id="getSampleFromRealWeather" resultType="java.lang.String" useCache="true">
    <select id="getSampleFromRealWeather" resultType="java.lang.String">
        select DATE_FORMAT(time, #{typeFormat}) as time
        from real_weather
        <where>
@@ -171,6 +182,10 @@
            <if test="windDir != null">
                and json->'$.windDir' = #{windDir}
            </if>
            <if test="windScale != null">
                and json->'$.windScale' = #{windScale}
            </if>
            <if test="condition == 0">
@@ -213,7 +228,7 @@
            </if>
            <if test="month != null">
                and DATE_FORMAT(time, '%m')=#{month}
                and DATE_FORMAT(time, '%m') = #{month}
            </if>
        </where>
    </select>