From d9cfe061b9b501511f5d769f751c8ff6bbcb1bf9 Mon Sep 17 00:00:00 2001
From: 648540858 <648540858@qq.com>
Date: 星期四, 17 八月 2023 15:20:25 +0800
Subject: [PATCH] 优化对讲释放流程

---
 src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceChannelMapper.java |   11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceChannelMapper.java b/src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceChannelMapper.java
index bd0d74f..bdc45bf 100644
--- a/src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceChannelMapper.java
+++ b/src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceChannelMapper.java
@@ -451,13 +451,18 @@
     @Select("select count(1) from wvp_device_channel")
     int getAllChannelCount();
 
+    // 璁惧涓诲瓙鐮佹祦閫昏緫START
+    @Update(value = {"UPDATE wvp_device_channel SET stream_id=null WHERE device_id=#{deviceId}"})
+    void clearPlay(String deviceId);
+    // 璁惧涓诲瓙鐮佹祦閫昏緫END
     @Select(value = {" <script>" +
             "select * " +
-            "from device_channel " +
+            "from wvp_device_channel " +
             "where device_id=#{deviceId}" +
-            " <if test='parentId != null '> and parent_id = #{parentId} </if>" +
-            " <if test='parentId == null '> and parent_id is null </if>" +
+            " <if test='parentId != null and parentId != deviceId'> and parent_id = #{parentId} </if>" +
+            " <if test='parentId == null or parentId == deviceId'> and parent_id is null or parent_id = #{deviceId}</if>" +
             " <if test='onlyCatalog == true '> and parental = 1 </if>" +
             " </script>"})
     List<DeviceChannel> getSubChannelsByDeviceId(String deviceId, String parentId, boolean onlyCatalog);
+
 }

--
Gitblit v1.8.0