From 106dbe94a4bcfc90fc646b0a1e017e23ad2b058b Mon Sep 17 00:00:00 2001
From: xufenglei <xufenglei>
Date: Mon, 07 May 2018 15:15:04 +0800
Subject: [PATCH] 三级警报数据
---
src/main/resources/mapper/AlarmDailyMapper.xml | 17 ++++++++++++++++-
1 files changed, 16 insertions(+), 1 deletions(-)
diff --git a/src/main/resources/mapper/AlarmDailyMapper.xml b/src/main/resources/mapper/AlarmDailyMapper.xml
index db13fc0..b29f1c5 100644
--- a/src/main/resources/mapper/AlarmDailyMapper.xml
+++ b/src/main/resources/mapper/AlarmDailyMapper.xml
@@ -80,7 +80,7 @@
SELECT
DATE_FORMAT(h.time, '%Y-%m') AS 'time'
<foreach collection="sensorKeys" open="," separator="+" close=" AS 'sum' " item="sensorKey">
- COUNT(json -> '$.${sensorKey}')
+ COUNT(json -> '$.${sensorKey}')
</foreach>
FROM
alarm_daily h
@@ -93,5 +93,20 @@
GROUP BY
DATE_FORMAT(h.time, '%Y-%m')
</select>
+
+ <select id="getAlarmDataByMonth" resultType="java.util.Map">
+ SELECT
+ <foreach collection="sensors" separator="," item="sensor">
+ COUNT(json -> '$.${sensor.sensorKey}') AS '${sensor.sensorKey}'
+ </foreach>
+ FROM
+ alarm_daily h
+ WHERE
+ h.time >= #{start}
+ AND h.time <![CDATA[<]]> #{end}
+ <if test="state != null">
+ AND h.state = #{state}
+ </if>
+ </select>
</mapper>
\ No newline at end of file
--
Gitblit v1.8.0