From 468e2b2ffbbb4e15dea11d1f9c7451a8097a3ab8 Mon Sep 17 00:00:00 2001
From: xiaoQQya <xiaoQQya@126.com>
Date: 星期日, 09 七月 2023 20:22:40 +0800
Subject: [PATCH] fix(play): 修复作为上级平台点播截取快照问题

---
 src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceAlarmMapper.java |   39 ++++++++++++++++++++-------------------
 1 files changed, 20 insertions(+), 19 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
index e41eb96..28a2e91 100644
--- a/src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceAlarmMapper.java
+++ b/src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceAlarmMapper.java
@@ -1,9 +1,10 @@
 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.apache.ibatis.annotations.Delete;
+import org.apache.ibatis.annotations.Insert;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Select;
 import org.springframework.stereotype.Repository;
 
 import java.util.List;
@@ -15,33 +16,33 @@
 @Repository
 public interface DeviceAlarmMapper {
 
-    @Insert("INSERT INTO device_alarm (deviceId, alarmPriority, alarmMethod, alarmTime, alarmDescription, longitude, latitude, alarmType ) " +
-            "VALUES ('${deviceId}', '${alarmPriority}', '${alarmMethod}', '${alarmTime}', '${alarmDescription}', ${longitude}, ${latitude}, '${alarmType}')")
+    @Insert("INSERT INTO wvp_device_alarm (device_id, channel_id, alarm_priority, alarm_method, alarm_time, alarm_description, longitude, latitude, alarm_type , create_time ) " +
+            "VALUES (#{deviceId}, #{channelId}, #{alarmPriority}, #{alarmMethod}, #{alarmTime}, #{alarmDescription}, #{longitude}, #{latitude}, #{alarmType}, #{createTime})")
     int add(DeviceAlarm alarm);
 
 
-    @Select(value = {" <script>" +
-            " SELECT * FROM device_alarm " +
+    @Select( value = {" <script>" +
+            " SELECT * FROM wvp_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 " +
+            " <if test=\"deviceId != null\" >  AND device_id = #{deviceId}</if>" +
+            " <if test=\"alarmPriority != null\" >  AND alarm_priority = #{alarmPriority} </if>" +
+            " <if test=\"alarmMethod != null\" >  AND alarm_method = #{alarmMethod} </if>" +
+            " <if test=\"alarmType != null\" >  AND alarm_type = #{alarmType} </if>" +
+            " <if test=\"startTime != null\" >  AND alarm_time &gt;= #{startTime} </if>" +
+            " <if test=\"endTime != null\" >  AND alarm_time &lt;= #{endTime} </if>" +
+            " ORDER BY alarm_time 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>" +
+            "DELETE FROM wvp_device_alarm WHERE 1=1 " +
+            " <if test=\"deviceIdList != null and id == null \" > AND device_id 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>" +
+            " <if test=\"time != null and id == null \" > AND alarm_time &lt;= #{time}</if>" +
+            " <if test=\"id != null\" > AND id = #{id}</if>" +
             " </script>"
             )
     int clearAlarmBeforeTime(Integer id, List<String> deviceIdList, String time);

--
Gitblit v1.8.0