From 33d898d8146223184fcaab82a9e16649434a1ab6 Mon Sep 17 00:00:00 2001
From: lizijie <lzjiiie@163.com>
Date: Fri, 09 Sep 2022 17:47:54 +0800
Subject: [PATCH] 千灯数据转发bug修改

---
 src/main/resources/mapper/AQIMapper.xml |   21 +++++++++++++++++----
 1 files changed, 17 insertions(+), 4 deletions(-)

diff --git a/src/main/resources/mapper/AQIMapper.xml b/src/main/resources/mapper/AQIMapper.xml
index ffddfca..2e80b9d 100644
--- a/src/main/resources/mapper/AQIMapper.xml
+++ b/src/main/resources/mapper/AQIMapper.xml
@@ -13,6 +13,19 @@
         )
     </insert>
 
+    <select id="getStationConfig" resultType="java.util.Map">
+        select station_code,city_code from aqi_station_config
+    </select>
+
+    <insert id="insertStationData">
+        insert into
+        history_aqi_station
+        values
+        <foreach collection="list" item="item" separator=",">
+            (#{item.time},#{item.json},#{item.stationCode},#{item.cityCode})
+        </foreach>
+    </insert>
+
     <select id="getO3" resultType="java.util.Map">
         select DATE_FORMAT(time, #{typeFormat}) time,
         ifnull(aqi_json->'$.O3C',aqi_json->'$.O3') 'O3'
@@ -24,8 +37,8 @@
         </foreach>
     </select>
 
-    <select id="getO3ByTime" resultType="java.lang.String">
-        select ifnull(aqi_json->'$.O3C',aqi_json->'$.O3') as 'O3'
+    <select id="getAqiFromHangzhou" resultType="java.lang.String">
+        select ifnull(aqi_json->'$.${sensorKey}',aqi_json->'$.${sensorKey1}') as '${sensorKey}'
         from hangzhou_aqi
         where city_code=#{cityCode}
         and DATE_FORMAT(time, #{typeFormat})=#{time}
@@ -39,8 +52,8 @@
         and DATE_FORMAT(time, '%Y%H')=#{yearAndHour}
     </select>
 
-    <select id="getO3FromHistory" resultType="java.lang.String">
-        select value ->'$.O3C' as 'O3'
+    <select id="getAqiFromHistory" resultType="java.lang.String">
+        select value ->'$.${sensorKey}' as '${sensorKey}'
         from history_aqi_${timeUnits}
         where city_code=#{cityCode}
         and DATE_FORMAT(time, #{typeFormat})=#{time}

--
Gitblit v1.8.0