From 3aa63f15b853e9103a906102c46d26784be7655e Mon Sep 17 00:00:00 2001
From: ZhuDongming <773644075@qq.com>
Date: Thu, 15 Aug 2019 17:23:45 +0800
Subject: [PATCH] 添加无人机历史查询最大值和最小值的sql语句
---
src/main/resources/mapper/HistoryMinutelyMapper.xml | 38 ++++++++++++++++++++++++++++++++++++++
1 files changed, 38 insertions(+), 0 deletions(-)
diff --git a/src/main/resources/mapper/HistoryMinutelyMapper.xml b/src/main/resources/mapper/HistoryMinutelyMapper.xml
index bdcb59e..770c396 100644
--- a/src/main/resources/mapper/HistoryMinutelyMapper.xml
+++ b/src/main/resources/mapper/HistoryMinutelyMapper.xml
@@ -155,4 +155,42 @@
ORDER BY
hm.time
</select>
+
+ <select id="getSensorDataMin" resultType="java.util.LinkedHashMap">
+ SELECT
+ DATE_FORMAT(hm.time,'%Y-%m-%d %H:%i:%s') time,
+ <foreach collection="sensorKeys" item="sensorKey" separator=",">
+ hm.json->'$.${sensorKey}[1]' as '${sensorKey}'
+ </foreach>
+ FROM
+ history_minutely as hm
+ <where>
+ <if test="mac!=null">
+ and hm.mac=#{mac}
+ </if>
+ and hm.time >= #{startTime}
+ and hm.time <![CDATA[<=]]> #{endTime}
+ </where>
+ ORDER BY
+ hm.time
+ </select>
+
+ <select id="getSensorDataMax" resultType="java.util.LinkedHashMap">
+ SELECT
+ DATE_FORMAT(hm.time,'%Y-%m-%d %H:%i:%s') time,
+ <foreach collection="sensorKeys" item="sensorKey" separator=",">
+ hm.json->'$.${sensorKey}[2]' as '${sensorKey}'
+ </foreach>
+ FROM
+ history_minutely as hm
+ <where>
+ <if test="mac!=null">
+ and hm.mac=#{mac}
+ </if>
+ and hm.time >= #{startTime}
+ and hm.time <![CDATA[<=]]> #{endTime}
+ </where>
+ ORDER BY
+ hm.time
+ </select>
</mapper>
\ No newline at end of file
--
Gitblit v1.8.0