From 3e8e381d224145a676ef932bf2878c6f4b204523 Mon Sep 17 00:00:00 2001
From: ZhuDongming <773644075@qq.com>
Date: Mon, 19 Aug 2019 08:59:02 +0800
Subject: [PATCH] 修改最大值、最小值按钮和信息保持在同一水平线上及调整起点和终点图标上1显示的位置

---
 src/main/resources/mapper/HistoryMapper.xml |   42 ++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 42 insertions(+), 0 deletions(-)

diff --git a/src/main/resources/mapper/HistoryMapper.xml b/src/main/resources/mapper/HistoryMapper.xml
index d200aa3..dba7c1e 100644
--- a/src/main/resources/mapper/HistoryMapper.xml
+++ b/src/main/resources/mapper/HistoryMapper.xml
@@ -191,4 +191,46 @@
         ORDER BY
         time
     </select>
+
+    <select id="getSensorDataTodayMin" resultType="java.util.LinkedHashMap">
+        SELECT
+        DATE_FORMAT(time,'%Y-%m-%d %H:%i') time,
+        <foreach collection="sensorKeys" separator="," item="sensorKey">
+            MIN(h.value ->'$.${sensorKey}') AS '${sensorKey}'
+        </foreach>
+        FROM
+        history h
+        <where>
+            <if test="mac!=null">
+                and h.mac=#{mac}
+            </if>
+            and h.time >= #{startTime}
+            and h.time <![CDATA[<=]]> #{endTime}
+        </where>
+        GROUP BY
+        DATE_FORMAT(time,'%Y-%m-%d %H:%i')
+        ORDER BY
+        time
+    </select>
+
+    <select id="getSensorDataTodayMax" resultType="java.util.LinkedHashMap">
+        SELECT
+        DATE_FORMAT(time,'%Y-%m-%d %H:%i') time,
+        <foreach collection="sensorKeys" separator="," item="sensorKey">
+            MAX(h.value ->'$.${sensorKey}') AS '${sensorKey}'
+        </foreach>
+        FROM
+        history h
+        <where>
+            <if test="mac!=null">
+                and h.mac=#{mac}
+            </if>
+            and h.time >= #{startTime}
+            and h.time <![CDATA[<=]]> #{endTime}
+        </where>
+        GROUP BY
+        DATE_FORMAT(time,'%Y-%m-%d %H:%i')
+        ORDER BY
+        time
+    </select>
 </mapper>
\ No newline at end of file

--
Gitblit v1.8.0