From 5476f8bcf411ce654c02fbd34b9086518adbd917 Mon Sep 17 00:00:00 2001 From: 于紫祥_1901 <email@yuzixiang_1910> Date: Thu, 10 Sep 2020 14:25:41 +0800 Subject: [PATCH] 三天数据对比 --- src/main/resources/mapper/ForecastWeatherMapper.xml | 29 ++++++++++++++++++++--------- 1 files changed, 20 insertions(+), 9 deletions(-) diff --git a/src/main/resources/mapper/ForecastWeatherMapper.xml b/src/main/resources/mapper/ForecastWeatherMapper.xml index 6f3b02f..e0e76d8 100644 --- a/src/main/resources/mapper/ForecastWeatherMapper.xml +++ b/src/main/resources/mapper/ForecastWeatherMapper.xml @@ -7,7 +7,7 @@ <select id="getForecastHour" resultType="java.util.Map"> SELECT DATE_FORMAT(time, #{typeFormat}) time, - (case when result is null then json->'$.temp' else result end) result + json->'$.O3C' 'O3' from forecast_weather where time >= #{start} AND time <![CDATA[<]]> #{end} @@ -33,13 +33,24 @@ <select id="getPrecip6Hour" resultType="java.util.Map"> - select - round(sum(json->'$.precip'),2) 'precip6' - FROM - forecast_weather - WHERE - time >= #{start} - AND time <![CDATA[<]]> #{end} - AND city_code = #{cityCode} + select + round(sum(json->'$.precip'),2) 'precip6' + FROM + forecast_weather + WHERE + time >= #{start} + AND time <![CDATA[<]]> #{end} + AND city_code = #{cityCode} + </select> + + <select id="getO38Hours" resultType="java.util.Map"> + select + AVG(json->'$.O3C') as 'O3C_8H' + FROM + forecast_weather + WHERE + time >= #{start} + AND time <![CDATA[<]]> #{end} + AND city_code = #{cityCode} </select> </mapper> \ No newline at end of file -- Gitblit v1.8.0