From a66d53c3cbfb0024804045f4d795be06089d4f9d Mon Sep 17 00:00:00 2001
From: lizijie <lzjiiie@163.com>
Date: Thu, 03 Dec 2020 17:54:15 +0800
Subject: [PATCH] 五分钟表相关代码,平均风向、平局风速工具类

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

diff --git a/src/main/resources/mapper/HistoryFiveMinutelyMapper.xml b/src/main/resources/mapper/HistoryFiveMinutelyMapper.xml
index 89eee37..642d314 100644
--- a/src/main/resources/mapper/HistoryFiveMinutelyMapper.xml
+++ b/src/main/resources/mapper/HistoryFiveMinutelyMapper.xml
@@ -2,7 +2,30 @@
 <!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>
+
+    <select id="getFiveMinutesSersorDataByMacsAndTime" resultType="map">
+        SELECT h.mac,h.time,
+        <foreach collection="sensorKeys" separator="," item="sensorKey">
+            json->'$.${sensorKey}' AS '${sensorKey}'
+        </foreach>
         from history_five_minutely_${yearAndMonth} h
         where time = #{time} and mac IN
         <foreach collection="macs" separator="," open="(" close=")" item="mac">

--
Gitblit v1.8.0