From 63ec97fc0ff6cdfb9dd3c9c0287ce784f0c2aaf5 Mon Sep 17 00:00:00 2001 From: ZhuDongming <773644075@qq.com> Date: Tue, 31 Mar 2020 09:52:18 +0800 Subject: [PATCH] update指定设备发送任务 --- src/main/resources/mapper/HistoryMapper.xml | 21 +++++++++++++++++++++ 1 files changed, 21 insertions(+), 0 deletions(-) diff --git a/src/main/resources/mapper/HistoryMapper.xml b/src/main/resources/mapper/HistoryMapper.xml index 4e677f0..823b530 100644 --- a/src/main/resources/mapper/HistoryMapper.xml +++ b/src/main/resources/mapper/HistoryMapper.xml @@ -120,6 +120,27 @@ h.mac </select> + <select id="getSensorDataByMacOnce" resultType="java.util.LinkedHashMap"> + SELECT + h.mac,DATE_FORMAT(time,'%Y-%m-%dT%H:%i') time, + <foreach collection="sensorKeys" separator="," item="sensorKey"> + AVG(value->'$.${sensorKey}') AS '${sensorKey}', + MAX(cast(h.value ->'$.${sensorKey}' as decimal(11,3))) AS 'MAX${sensorKey}', + MIN(cast(h.value ->'$.${sensorKey}' as decimal(11,3))) AS 'MIN${sensorKey}' + </foreach> + FROM + history h + WHERE + h.time >= #{start} + AND h.time <![CDATA[<]]> #{end} + and h.mac in + <foreach collection="macList" index="index" item="mac" open="(" separator="," close=")"> + #{mac} + </foreach> + group by + h.mac,DATE_FORMAT(time,'%Y-%m-%dT%H:%i') + </select> + <select id="getSensorDataOnce" resultType="java.util.LinkedHashMap"> SELECT h.mac,DATE_FORMAT(time,'%Y-%m-%dT%H:%i') time, -- Gitblit v1.8.0