jinpengyong
2020-12-01 dc9091d686b412eab84d461d13d0611f79e65810
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>
@@ -130,11 +138,11 @@
            </if>
            <if test="startTemp != null">
                and cast(value->'$.temp' as decimal(10, 1)) >= #{startTemp}
                and cast(value->'$.temp' as decimal(10, 0)) >= #{startTemp}
            </if>
            <if test="endTemp != null">
                and cast(value->'$.temp' as decimal(10, 1)) <![CDATA[<=]]> #{endTemp}
                and cast(value->'$.temp' as decimal(10, 0)) <![CDATA[<=]]> #{endTemp}
            </if>
            <if test="startPressure != null">
@@ -159,11 +167,10 @@
                    #{hour}
                </foreach>
            </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 +178,10 @@
            <if test="windDir != null">
                and json->'$.windDir' = #{windDir}
            </if>
            <if test="windScale != null">
                and json->'$.windScale' = #{windScale}
            </if>
            <if test="condition == 0">
@@ -182,11 +193,11 @@
            </if>
            <if test="startTemp != null">
                and cast(json->'$.temp' as decimal(10, 1)) >= #{startTemp}
                and cast(json->'$.temp' as decimal(10, 0)) >= #{startTemp}
            </if>
            <if test="endTemp != null">
                and cast(json->'$.temp' as decimal(10, 1)) <![CDATA[<=]]> #{endTemp}
                and cast(json->'$.temp' as decimal(10, 0)) <![CDATA[<=]]> #{endTemp}
            </if>
            <if test="startPressure != null">
@@ -210,10 +221,6 @@
                <foreach collection="hours" open="(" separator="," close=")" item="hour">
                    #{hour}
                </foreach>
            </if>
            <if test="month != null">
                and DATE_FORMAT(time, '%m')=#{month}
            </if>
        </where>
    </select>