From 9442c37ce73497a66d540f035e58201b54656e49 Mon Sep 17 00:00:00 2001 From: 648540858 <648540858@qq.com> Date: 星期二, 15 二月 2022 17:41:09 +0800 Subject: [PATCH] 优化级联添加通道流程 --- src/main/java/com/genersoft/iot/vmp/storager/dao/PlatformGbStreamMapper.java | 32 +++++++++++++++++++++++++++----- 1 files changed, 27 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/genersoft/iot/vmp/storager/dao/PlatformGbStreamMapper.java b/src/main/java/com/genersoft/iot/vmp/storager/dao/PlatformGbStreamMapper.java index 248b37a..1e15360 100644 --- a/src/main/java/com/genersoft/iot/vmp/storager/dao/PlatformGbStreamMapper.java +++ b/src/main/java/com/genersoft/iot/vmp/storager/dao/PlatformGbStreamMapper.java @@ -5,6 +5,7 @@ import com.genersoft.iot.vmp.gb28181.bean.PlatformCatalog; import com.genersoft.iot.vmp.gb28181.bean.PlatformGbStream; import com.genersoft.iot.vmp.media.zlm.dto.StreamProxyItem; +import com.genersoft.iot.vmp.media.zlm.dto.StreamPushItem; import org.apache.ibatis.annotations.*; import org.springframework.stereotype.Repository; @@ -19,6 +20,17 @@ "('${app}', '${stream}', '${platformId}', '${catalogId}')") int add(PlatformGbStream platformGbStream); + + @Insert("<script> " + + "REPLACE into platform_gb_stream " + + "(app, stream, platformId, catalogId) " + + "values " + + "<foreach collection='streamPushItems' index='index' item='item' separator=','> " + + "('${item.app}', '${item.stream}', '${platformId}', '${catalogId}')" + + "</foreach> " + + "</script>") + int batchAdd(String platformId, String catalogId, List<StreamPushItem> streamPushItems); + @Delete("DELETE FROM platform_gb_stream WHERE app=#{app} AND stream=#{stream}") int delByAppAndStream(String app, String stream); @@ -32,8 +44,7 @@ "LEFT JOIN parent_platform pp ON pp.serverGBId = pgs.platformId " + "WHERE " + "pgs.app =#{app} " + - "AND pgs.stream =#{stream} " + - "GROUP BY pp.serverGBId") + "AND pgs.stream =#{stream} ") List<ParentPlatform> selectByAppAndStream(String app, String stream); @Select("SELECT pgs.*, gs.gbId FROM platform_gb_stream pgs " + @@ -53,7 +64,7 @@ " left join platform_gb_stream pgs\n" + " on gs.app = pgs.app and gs.stream = pgs.stream\n" + "where pgs.platformId=#{platformId} and pgs.catalogId=#{catalogId}") - List<PlatformCatalog> queryChannelInParentPlatformAndCatalogForCatlog(String platformId, String catalogId); + List<PlatformCatalog> queryChannelInParentPlatformAndCatalogForCatalog(String platformId, String catalogId); @Delete("DELETE FROM platform_gb_stream WHERE catalogId=#{id}") int delByCatalogId(String id); @@ -73,6 +84,17 @@ "</script> ") List<ParentPlatform> queryPlatFormListForGBWithGBId(String app, String stream, List<String> platforms); - @Select("SELECT * FROM platform_gb_stream WHERE app=#{app} AND stream=#{stream} AND platformId=#{platformId}") - int delByAppAndStreamAndPlatform(String app, String streamId, String platformId); + @Delete("DELETE FROM platform_gb_stream WHERE app=#{app} AND stream=#{stream} AND platformId=#{platformId}") + int delByAppAndStreamAndPlatform(String app, String stream, String platformId); + + @Delete("<script> "+ + "DELETE FROM platform_gb_stream where " + + "<foreach collection='gbStreams' item='item' separator='or'>" + + "(app=#{item.app} and stream=#{item.stream}) " + + "</foreach>" + + "</script>") + void delByGbStreams(List<GbStream> gbStreams); + + + } -- Gitblit v1.8.0