From 1a406e3e206af1ab7e38042548a085b078b6ca09 Mon Sep 17 00:00:00 2001
From: kaiyu <404897439@qq.com>
Date: Tue, 15 Dec 2020 14:34:26 +0800
Subject: [PATCH] 增加websocket单位
---
src/main/resources/mapper/ForecastWeatherMapper.xml | 31 +++++++++++++++++++++----------
1 files changed, 21 insertions(+), 10 deletions(-)
diff --git a/src/main/resources/mapper/ForecastWeatherMapper.xml b/src/main/resources/mapper/ForecastWeatherMapper.xml
index 16fffbb..9ce0208 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->'$.${sensor1}' '${sensor2}'
from forecast_weather
where time >= #{start}
AND time <![CDATA[<]]> #{end}
@@ -26,20 +26,31 @@
</select>
<update id="updateForecastWeather">
- update forecast_weather1 set json=#{json}
+ update forecast_weather set json=#{json}
where city_code=#{cityCode}
and time=#{time}
</update>
<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
+ cast(AVG(json->'$.O3C') as UNSIGNED integer) 'O3_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