From d3c68dd9fec28c76e0bb61879dffaa7b0ec1e690 Mon Sep 17 00:00:00 2001 From: jinpengyong <jpy123456> Date: Mon, 23 Nov 2020 09:50:07 +0800 Subject: [PATCH] update --- src/main/resources/mapper/WeatherMapper.xml | 23 +++++++++++++++++++---- 1 files changed, 19 insertions(+), 4 deletions(-) diff --git a/src/main/resources/mapper/WeatherMapper.xml b/src/main/resources/mapper/WeatherMapper.xml index 06ce0a4..51d8c73 100644 --- a/src/main/resources/mapper/WeatherMapper.xml +++ b/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> -- Gitblit v1.8.0