From 17c9b0305aaf3f48ea090e14dbcc3e6ab4f399c2 Mon Sep 17 00:00:00 2001 From: ZhuDongming <773644075@qq.com> Date: Thu, 15 Aug 2019 17:24:51 +0800 Subject: [PATCH] 新增页面无人机查询最大值和最小值的功能 --- 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