From da0abda12d95d701f8873db506136898e66fef8e Mon Sep 17 00:00:00 2001
From: 于紫祥_1901 <email@yuzixiang_1910>
Date: Wed, 02 Dec 2020 11:10:33 +0800
Subject: [PATCH] aqi首要污染物算法更新

---
 src/main/resources/mapper/HistoryFiveMinutelyMapper.xml |   13 ++++++++++++-
 1 files changed, 12 insertions(+), 1 deletions(-)

diff --git a/src/main/resources/mapper/HistoryFiveMinutelyMapper.xml b/src/main/resources/mapper/HistoryFiveMinutelyMapper.xml
index 89eee37..3c8e2b7 100644
--- a/src/main/resources/mapper/HistoryFiveMinutelyMapper.xml
+++ b/src/main/resources/mapper/HistoryFiveMinutelyMapper.xml
@@ -2,11 +2,22 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.moral.mapper.HistoryFiveMinutelyMapper">
     <select id="getFiveMinutesDataByMacsAndTime" resultType="map">
-        SELECT h.mac,json->'$.${sensorKey}' as #{sensorKey}
+        SELECT h.mac,h.time,json->'$.${sensorKey}' as #{sensorKey}
         from history_five_minutely_${yearAndMonth} h
         where time = #{time} and mac IN
         <foreach collection="macs" separator="," open="(" close=")" item="mac">
             #{mac}
         </foreach>
     </select>
+
+    <select id="getFiveMinutesDataByMac" resultType="java.util.LinkedHashMap">
+        select
+        <foreach collection="sensorKeys" separator="," item="sensorKey">
+          json->'$.${sensorKey}' AS '${sensorKey}'
+        </foreach>
+        FROM
+        history_five_minutely_${yearAndMonth} h
+        where  h.time = #{time}
+        and h.mac = #{mac}
+    </select>
 </mapper>
\ No newline at end of file

--
Gitblit v1.8.0