From f9b8ea6573126f913da80be5c507c21c907246ee Mon Sep 17 00:00:00 2001
From: 648540858 <648540858@qq.com>
Date: 星期三, 26 一月 2022 11:00:48 +0800
Subject: [PATCH] Merge remote-tracking branch 'github/wvp-28181-2.0' into wvp-28181-2.0
---
src/main/java/com/genersoft/iot/vmp/storager/dao/PlatformChannelMapper.java | 48 ++++++++++++++++++++++++++++++++++++++++++++++--
1 files changed, 46 insertions(+), 2 deletions(-)
diff --git a/src/main/java/com/genersoft/iot/vmp/storager/dao/PlatformChannelMapper.java b/src/main/java/com/genersoft/iot/vmp/storager/dao/PlatformChannelMapper.java
index db2bb77..4f5de2b 100644
--- a/src/main/java/com/genersoft/iot/vmp/storager/dao/PlatformChannelMapper.java
+++ b/src/main/java/com/genersoft/iot/vmp/storager/dao/PlatformChannelMapper.java
@@ -2,6 +2,8 @@
import com.genersoft.iot.vmp.gb28181.bean.Device;
import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel;
+import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform;
+import com.genersoft.iot.vmp.gb28181.bean.PlatformCatalog;
import com.genersoft.iot.vmp.vmanager.gb28181.platform.bean.ChannelReduce;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
@@ -25,8 +27,10 @@
List<String> findChannelRelatedPlatform(String platformId, List<String> deviceAndChannelIds);
@Insert("<script> "+
- "INSERT INTO platform_gb_channel (channelId, deviceId, platformId, deviceAndChannelId) VALUES" +
- "<foreach collection='channelReducesToAdd' item='item' separator=','> ('${item.channelId}','${item.deviceId}', '${platformId}', '${item.deviceId}_${item.channelId}' )</foreach>" +
+ "INSERT INTO platform_gb_channel (channelId, deviceId, platformId, deviceAndChannelId, catalogId) VALUES" +
+ "<foreach collection='channelReducesToAdd' item='item' separator=','>" +
+ " ('${item.channelId}','${item.deviceId}', '${platformId}', '${item.deviceId}_${item.channelId}' , '${item.catalogId}' )" +
+ "</foreach>" +
"</script>")
int addChannels(String platformId, List<ChannelReduce> channelReducesToAdd);
@@ -38,6 +42,11 @@
int delChannelForGB(String platformId, List<ChannelReduce> channelReducesToDel);
@Delete("<script> "+
+ "DELETE FROM platform_gb_channel WHERE deviceId='${deviceId}' " +
+ "</script>")
+ int delChannelForDeviceId(String deviceId);
+
+ @Delete("<script> "+
"DELETE FROM platform_gb_channel WHERE platformId='${platformId}'" +
"</script>")
int cleanChannelForGB(String platformId);
@@ -47,6 +56,41 @@
"platformId='${platformId}' AND channelId='${channelId}' ) AND channelId='${channelId}'")
DeviceChannel queryChannelInParentPlatform(String platformId, String channelId);
+
+ @Select("select dc.channelId as id, dc.name as name, pgc.platformId as platformId, pgc.catalogId as parentId, 0 as childrenCount, 1 as type " +
+ "from device_channel dc left join platform_gb_channel pgc on dc.deviceId = pgc.deviceId and dc.channelId = pgc.channelId " +
+ "where pgc.platformId=#{platformId} and pgc.catalogId=#{catalogId}")
+ List<PlatformCatalog> queryChannelInParentPlatformAndCatalog(String platformId, String catalogId);
+
@Select("SELECT * FROM device WHERE deviceId = (SELECT deviceId FROM platform_gb_channel WHERE platformId='${platformId}' AND channelId='${channelId}')")
Device queryVideoDeviceByPlatformIdAndChannelId(String platformId, String channelId);
+
+ @Delete("<script> "+
+ "DELETE FROM platform_gb_channel WHERE catalogId=#{id}" +
+ "</script>")
+ int delByCatalogId(String id);
+
+ @Delete("<script> "+
+ "DELETE FROM platform_gb_channel WHERE catalogId=#{parentId} AND platformId=#{platformId} AND channelId=#{id}" +
+ "</script>")
+ int delByCatalogIdAndChannelIdAndPlatformId(PlatformCatalog platformCatalog);
+
+ @Select("<script> " +
+ "SELECT " +
+ "pp.* " +
+ "FROM " +
+ "parent_platform pp " +
+ "left join platform_gb_channel pgc on " +
+ "pp.serverGBId = pgc.platformId " +
+ "WHERE " +
+ "pgc.channelId = #{channelId} and pp.status = true " +
+ "AND pp.serverGBId IN" +
+ "<foreach collection='platforms' item='item' open='(' separator=',' close=')' > #{item}</foreach>" +
+ "</script> ")
+ List<ParentPlatform> queryPlatFormListForGBWithGBId(String channelId, List<String> platforms);
+
+ @Delete("<script> " +
+ "DELETE FROM platform_gb_channel WHERE platformId=#{serverGBId}" +
+ "</script>")
+ void delByPlatformId(String serverGBId);
}
--
Gitblit v1.8.0