From 8a4fccc993cbef14b83443d91e51e9b74664eab5 Mon Sep 17 00:00:00 2001
From: jinpengyong <jpy123456>
Date: Mon, 10 Aug 2020 11:18:46 +0800
Subject: [PATCH] update

---
 src/main/resources/mapper/HangzhouAqiMapper.xml |   11 +++++------
 1 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/src/main/resources/mapper/HangzhouAqiMapper.xml b/src/main/resources/mapper/HangzhouAqiMapper.xml
index 753ed7f..5e1a166 100644
--- a/src/main/resources/mapper/HangzhouAqiMapper.xml
+++ b/src/main/resources/mapper/HangzhouAqiMapper.xml
@@ -71,13 +71,13 @@
     <select id="getAqiDataByAreaCode" resultType="java.util.Map">
     SELECT
     DATE_FORMAT(time, #{typeFormat}) time,
-    ifnull(aqi_json->'$.${sensors}',"") as '${sensors2}'
+    ifnull(aqi_json->'$.O3C',aqi_json->'$.O3') as 'O3'
     FROM
     hangzhou_aqi ha
     WHERE
     ha.time >= #{start}
     AND ha.time <![CDATA[<]]> #{end}
-    AND ha.city_code = #{areaCode}
+    AND ha.city_code = #{cityCode}
     ORDER BY
     time
   </select>
@@ -91,21 +91,20 @@
     WHERE
     time >= #{start}
     AND time <![CDATA[<]]> #{end}
-    AND city_code = #{areaCode}
+    AND city_code = #{cityCode}
     ORDER BY
     time
     </select>
 
     <select id="getAvgO3EightHours" resultType="java.util.Map">
     select
-    AVG(aqi_json->'$.O3') 'O3������8������',
-    AVG(aqi_json->'$.O3C') 'O3������8������'
+    AVG(case when aqi_json->'$.O3C' is null then aqi_json->'$.O3' else aqi_json->'$.O3C' end)  as 'O3C_8H'
     FROM
     hangzhou_aqi
     WHERE
     time >= #{start}
     AND time <![CDATA[<]]> #{end}
-    AND city_code = #{areaCode}
+    AND city_code = #{cityCode}
     </select>
 
 </mapper>

--
Gitblit v1.8.0