From 85f0196891cdf5bc2f80f384df47c7d27fc5d23a Mon Sep 17 00:00:00 2001
From: ‘liusuyi’ <1951119284@qq.com>
Date: 星期三, 09 八月 2023 15:10:52 +0800
Subject: [PATCH] 修改雷达报警聚合方式
---
ard-work/src/main/resources/mapper/alarm/ArdAlarmRadarMapper.xml | 43 ++++++++++++++++++++++---------------------
1 files changed, 22 insertions(+), 21 deletions(-)
diff --git a/ard-work/src/main/resources/mapper/alarm/ArdAlarmRadarMapper.xml b/ard-work/src/main/resources/mapper/alarm/ArdAlarmRadarMapper.xml
index ebe4f66..6819e98 100644
--- a/ard-work/src/main/resources/mapper/alarm/ArdAlarmRadarMapper.xml
+++ b/ard-work/src/main/resources/mapper/alarm/ArdAlarmRadarMapper.xml
@@ -128,27 +128,28 @@
</delete>
<select id="selectListAllByCommand" resultMap="ArdAlarmRadarResult">
- SELECT T
- .*
- FROM (
- SELECT aar.ID,
- aar.target_id,
- aar.NAME,
- aar.alarm_type,
- aar.alarm_time,
- aar.longitude,
- aar.latitude,
- ROW_NUMBER() OVER ( PARTITION BY aar.NAME ORDER BY aar.alarm_time DESC ) AS rn, COUNT(CASE WHEN aar.view_time IS NULL THEN 1 END) OVER ( PARTITION BY aar.NAME ) AS COUNT,
- COUNT ( aar.alarm_time ) OVER ( PARTITION BY aar.NAME ) AS total
- FROM
- ard_alarm_radar aar
- WHERE
- aar.alarm_time >= ( CURRENT_TIMESTAMP - INTERVAL '%${refreshTime}%' MINUTE )
- AND aar.alarm_type = #{alarmType}
- ORDER BY
- aar.alarm_time DESC
- ) T
- WHERE T.rn = 1
+ select aaar.ID,
+ aaar.target_id,
+ aaar.NAME,
+ aaar.alarm_type,
+ aaar.alarm_time,
+ aaar.longitude,
+ aaar.latitude,
+ r.COUNT,
+ r.total from
+ (SELECT
+ aar.NAME,
+ max(aar.create_time) as create_time1,
+ count(case when aar.view_time is null THEN 1 END) as count,
+ count(aar.id) as total
+ FROM
+ ard_alarm_radar aar
+ WHERE
+ aar.create_time >= ( CURRENT_TIMESTAMP - INTERVAL '%${refreshTime}%' MINUTE )
+ AND aar.alarm_type = #{alarmType}
+ GROUP BY aar.NAME
+ ) r
+ INNER JOIN ard_alarm_radar aaar ON r.create_time1 = aaar.create_time
</select>
<select id="selectCountByAlarmTime" resultType="Integer">
SELECT COUNT(DISTINCT aar.name)
--
Gitblit v1.9.3