From f1d079f9c0b3d384090477ca54e0548373d62b57 Mon Sep 17 00:00:00 2001
From: zhongrj <646384940@qq.com>
Date: Thu, 16 Jan 2025 11:56:39 +0800
Subject: [PATCH] 配置修改

---
 src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceAlarmMapper.java |   48 ++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 48 insertions(+), 0 deletions(-)

diff --git a/src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceAlarmMapper.java b/src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceAlarmMapper.java
new file mode 100644
index 0000000..bc651ce
--- /dev/null
+++ b/src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceAlarmMapper.java
@@ -0,0 +1,48 @@
+package com.genersoft.iot.vmp.storager.dao;
+
+import com.genersoft.iot.vmp.gb28181.bean.DeviceAlarm;
+import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel;
+import com.genersoft.iot.vmp.vmanager.gb28181.platform.bean.ChannelReduce;
+import org.apache.ibatis.annotations.*;
+import org.springframework.stereotype.Repository;
+
+import java.util.List;
+
+/**
+ * 用于存储设备的报警信息
+ */
+@Mapper
+@Repository
+public interface DeviceAlarmMapper {
+
+    @Insert("INSERT INTO device_alarm (deviceId, channelId, alarmPriority, alarmMethod, alarmTime, alarmDescription, longitude, latitude, alarmType , createTime ) " +
+            "VALUES ('${deviceId}', '${channelId}', '${alarmPriority}', '${alarmMethod}', '${alarmTime}', '${alarmDescription}', ${longitude}, ${latitude}, '${alarmType}', '${createTime}')")
+    int add(DeviceAlarm alarm);
+
+
+    @Select(value = {" <script>" +
+            " SELECT * FROM device_alarm " +
+            " WHERE 1=1 " +
+            " <if test=\"deviceId != null\" >  AND deviceId = '${deviceId}'</if>" +
+            " <if test=\"alarmPriority != null\" >  AND alarmPriority = '${alarmPriority}' </if>" +
+            " <if test=\"alarmMethod != null\" >  AND alarmMethod = '${alarmMethod}' </if>" +
+            " <if test=\"alarmType != null\" >  AND alarmType = '${alarmType}' </if>" +
+            " <if test=\"startTime != null\" >  AND alarmTime &gt;= '${startTime}' </if>" +
+            " <if test=\"endTime != null\" >  AND alarmTime &lt;= '${endTime}' </if>" +
+            " ORDER BY alarmTime ASC " +
+            " </script>"})
+    List<DeviceAlarm> query(String deviceId, String alarmPriority, String alarmMethod,
+                            String alarmType, String startTime, String endTime);
+
+
+    @Delete(" <script>" +
+            "DELETE FROM device_alarm WHERE 1=1 " +
+            " <if test=\"deviceIdList != null and id == null \" > AND deviceId in " +
+            "<foreach collection='deviceIdList'  item='item'  open='(' separator=',' close=')' > '${item}'</foreach>" +
+            "</if>" +
+            " <if test=\"time != null and id == null \" > AND alarmTime &lt;= '${time}'</if>" +
+            " <if test=\"id != null\" > AND id = ${id}</if>" +
+            " </script>"
+            )
+    int clearAlarmBeforeTime(Integer id, List<String> deviceIdList, String time);
+}

--
Gitblit v1.9.3