From 0362c0c8502a81fc974afb8d2aff85d9efd7bbb1 Mon Sep 17 00:00:00 2001
From: ‘liusuyi’ <1951119284@qq.com>
Date: 星期四, 29 六月 2023 17:28:22 +0800
Subject: [PATCH] 修改报警逻辑 增加优先级队列

---
 ard-work/src/main/resources/mapper/alarm/ArdAlarmCameraMapper.xml |   14 +++++++++++++-
 1 files changed, 13 insertions(+), 1 deletions(-)

diff --git a/ard-work/src/main/resources/mapper/alarm/ArdAlarmCameraMapper.xml b/ard-work/src/main/resources/mapper/alarm/ArdAlarmCameraMapper.xml
index 9d29056..e93692a 100644
--- a/ard-work/src/main/resources/mapper/alarm/ArdAlarmCameraMapper.xml
+++ b/ard-work/src/main/resources/mapper/alarm/ArdAlarmCameraMapper.xml
@@ -36,7 +36,13 @@
             <if test="cameraChannel != null "> and camera_channel = #{cameraChannel}</if>
             <if test="cameraType != null  and cameraType != ''"> and camera_type = #{cameraType}</if>
             <if test="alarmType != null  and alarmType != ''"> and alarm_type = #{alarmType}</if>
-            <if test="alarmTime != null "> and alarm_time = #{alarmTime}</if>
+<!--            <if test="alarmTime != null "> and alarm_time = #{alarmTime}</if>-->
+            <if test="params.beginTime != null and params.beginTime != ''"><!-- 寮�濮嬫椂闂存绱� -->
+                AND alarm_time &gt;= to_timestamp(#{params.beginTime},'yyyy-MM-DD HH24:MI:ss')
+            </if>
+            <if test="params.endTime != null and params.endTime != ''"><!-- 缁撴潫鏃堕棿妫�绱� -->
+                AND alarm_time &lt;= to_timestamp(#{params.endTime},'yyyy-MM-DD HH24:MI:ss')
+            </if>
             <if test="longitude != null "> and longitude = #{longitude}</if>
             <if test="latitude != null "> and latitude = #{latitude}</if>
             <if test="ruleId != null "> and rule_id = #{ruleId}</if>
@@ -46,6 +52,7 @@
             <if test="userId != null  and userId != ''"> and user_id = #{userId}</if>
             <if test="deptId != null "> and dept_id = #{deptId}</if>
         </where>
+        order by alarm_time desc
     </select>
     
     <select id="selectArdAlarmCameraById" parameterType="String" resultMap="ArdAlarmCameraResult">
@@ -154,4 +161,9 @@
         WHERE
             T.rn = 1
     </select>
+    <select id="selectCountByAlarmTime" resultType="Integer">
+        SELECT COUNT(DISTINCT aac.camera_name)
+        FROM ard_alarm_camera aac
+        WHERE aac.alarm_time >= CURRENT_TIMESTAMP - INTERVAL '%${refreshTime}%' MINUTE
+    </select>
 </mapper>
\ No newline at end of file

--
Gitblit v1.9.3