From 5fed7b486fea656ae9878166e3530b7e29eae7eb Mon Sep 17 00:00:00 2001 From: lizijie <lzjiiie@163.com> Date: Fri, 30 Aug 2019 09:57:06 +0800 Subject: [PATCH] 站点排名 --- src/main/resources/mapper/HistoryMapper.xml | 14 ++++++++++++++ 1 files changed, 14 insertions(+), 0 deletions(-) diff --git a/src/main/resources/mapper/HistoryMapper.xml b/src/main/resources/mapper/HistoryMapper.xml index 7aec033..ace511c 100644 --- a/src/main/resources/mapper/HistoryMapper.xml +++ b/src/main/resources/mapper/HistoryMapper.xml @@ -193,5 +193,19 @@ ORDER BY time </select> + + <select id="getAVGSensorRankByMonitorPointIdList" resultType="java.util.Map"> + SELECT mp.name, AVG(JSON_EXTRACT(h.value,'$.${sensor}[0]')) sensor + FROM device d, history h, monitor_point mp + WHERE d.mac=h.mac + And mp.id=d.monitor_point_id + AND d.monitor_point_id IN + <foreach collection="monitorPointIdList" index="index" item="monitorPointId" open="(" separator="," close=")"> + #{monitorPointId} + </foreach> + AND h.time BETWEEN #{before5Time} AND #{endTime} + GROUP BY d.monitor_point_id + ORDER BY AVG(JSON_EXTRACT(h.value,'$.${sensor}[0]')) DESC + </select> </mapper> \ No newline at end of file -- Gitblit v1.8.0