From 764d04b497356ba6bcbb75fd42b51eca750f7223 Mon Sep 17 00:00:00 2001 From: 648540858 <648540858@qq.com> Date: 星期三, 29 五月 2024 15:02:51 +0800 Subject: [PATCH] 调整上级观看消息的发送 --- src/main/java/com/genersoft/iot/vmp/storager/dao/PlatformGbStreamMapper.java | 114 +++++++++++++++++++++++++++++++++++++------------------- 1 files changed, 75 insertions(+), 39 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 old mode 100644 new mode 100755 index 248b37a..e4fc356 --- 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; @@ -15,64 +16,99 @@ @Repository public interface PlatformGbStreamMapper { - @Insert("REPLACE INTO platform_gb_stream (app, stream, platformId, catalogId) VALUES" + - "('${app}', '${stream}', '${platformId}', '${catalogId}')") + @Insert("INSERT INTO wvp_platform_gb_stream (gb_stream_id, platform_id, catalog_id) VALUES" + + "( #{gbStreamId}, #{platformId}, #{catalogId})") int add(PlatformGbStream platformGbStream); - @Delete("DELETE FROM platform_gb_stream WHERE app=#{app} AND stream=#{stream}") - int delByAppAndStream(String app, String stream); - @Delete("DELETE FROM platform_gb_stream WHERE platformId=#{platformId}") + @Insert("<script> " + + "INSERT into wvp_platform_gb_stream " + + "(gb_stream_id, platform_id, catalog_id) " + + "values " + + "<foreach collection='streamPushItems' index='index' item='item' separator=','> " + + "(#{item.gbStreamId}, #{item.platform_id}, #{item.catalogId})" + + "</foreach> " + + "</script>") + int batchAdd(List<StreamPushItem> streamPushItems); + + @Delete("DELETE from wvp_platform_gb_stream WHERE gb_stream_id = (select gb_stream_id from wvp_gb_stream where app=#{app} AND stream=#{stream})") + int delByAppAndStream(@Param("app") String app, @Param("stream") String stream); + + @Delete("DELETE from wvp_platform_gb_stream WHERE platform_id=#{platformId}") int delByPlatformId(String platformId); @Select("SELECT " + "pp.* " + "FROM " + - "platform_gb_stream pgs " + - "LEFT JOIN parent_platform pp ON pp.serverGBId = pgs.platformId " + + "wvp_platform_gb_stream pgs " + + "LEFT JOIN wvp_platform pp ON pp.server_gb_id = pgs.platform_id " + + "LEFT join wvp_gb_stream gs ON gs.gb_stream_id = pgs.gb_stream_id " + "WHERE " + - "pgs.app =#{app} " + - "AND pgs.stream =#{stream} " + - "GROUP BY pp.serverGBId") - List<ParentPlatform> selectByAppAndStream(String app, String stream); + "gs.app =#{app} " + + "AND gs.stream =#{stream} ") + List<ParentPlatform> selectByAppAndStream(@Param("app") String app, @Param("stream") String stream); - @Select("SELECT pgs.*, gs.gbId FROM platform_gb_stream pgs " + - "LEFT JOIN gb_stream gs ON pgs.app = gs.app AND pgs.stream = gs.stream " + - "WHERE pgs.app=#{app} AND pgs.stream=#{stream} AND pgs.platformId=#{serverGBId}") - StreamProxyItem selectOne(String app, String stream, String serverGBId); + @Select("SELECT pgs.*, gs.gb_id from wvp_platform_gb_stream pgs " + + "LEFT join wvp_gb_stream gs ON pgs.gb_stream_id = gs.gb_stream_id " + + "WHERE gs.app=#{app} AND gs.stream=#{stream} AND pgs.platform_id=#{platformId}") + StreamProxyItem selectOne(@Param("app") String app, @Param("stream") String stream, @Param("platformId") String platformId); - @Select("select gs.* \n" + - "from gb_stream gs\n" + - " 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<GbStream> queryChannelInParentPlatformAndCatalog(String platformId, String catalogId); + @Select("<script> " + + "select gs.* " + + " from wvp_gb_stream gs\n" + + " left join wvp_platform_gb_stream pgs\n" + + " on gs.gb_stream_id = pgs.gb_stream_id\n" + + " where pgs.platform_id=#{platformId} " + + " <if test='catalogId != null' > and pgs.catalog_id=#{catalogId}</if>" + + "</script>") + List<GbStream> queryChannelInParentPlatformAndCatalog(@Param("platformId") String platformId, @Param("catalogId") String catalogId); - @Select("select gs.gbId as id, gs.name as name, pgs.platformId as platformId, pgs.catalogId as catalogId , 0 as childrenCount, 2 as type\n" + - "from gb_stream gs\n" + - " 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); - - @Delete("DELETE FROM platform_gb_stream WHERE catalogId=#{id}") - int delByCatalogId(String id); + @Select("select gs.gb_id as id, gs.name as name, pgs.platform_id as platform_id, pgs.catalog_id as catalog_id , 0 as children_count, 2 as type\n" + + "from wvp_gb_stream gs\n" + + " left join wvp_platform_gb_stream pgs\n" + + " on gs.gb_stream_id = pgs.gb_stream_id\n" + + "where pgs.platform_id=#{platformId} and pgs.catalog_id=#{catalogId}") + List<PlatformCatalog> queryChannelInParentPlatformAndCatalogForCatalog(@Param("platformId") String platformId, @Param("catalogId") String catalogId); @Select("<script> " + "SELECT " + "pp.* " + "FROM " + - "parent_platform pp " + - "left join platform_gb_stream pgs on " + - "pp.serverGBId = pgs.platformId " + + "wvp_platform pp " + + "left join wvp_platform_gb_stream pgs on " + + "pp.server_gb_id = pgs.platform_id " + + "left join wvp_gb_stream gs " + + "on gs.gb_stream_id = pgs.gb_stream_id " + "WHERE " + - "pgs.app = #{app} " + - "AND pgs.stream = #{stream}" + - "AND pp.serverGBId IN" + + "gs.app = #{app} " + + "AND gs.stream = #{stream}" + + "AND pp.server_gb_id IN" + "<foreach collection='platforms' item='item' open='(' separator=',' close=')' > #{item}</foreach>" + "</script> ") - List<ParentPlatform> queryPlatFormListForGBWithGBId(String app, String stream, List<String> platforms); + List<ParentPlatform> queryPlatFormListForGBWithGBId(@Param("app") String app, @Param("stream") String stream, @Param("platforms") 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 wvp_platform_gb_stream WHERE gb_stream_id = (select id from wvp_gb_stream where app=#{app} AND stream=#{stream}) AND platform_id=#{platformId}") + int delByAppAndStreamAndPlatform(String app, String stream, String platformId); + + @Delete("<script> "+ + "DELETE from wvp_platform_gb_stream where gb_stream_id in " + + "<foreach collection='gbStreams' item='item' open='(' separator=',' close=')' >" + + "#{item.gbStreamId}" + + "</foreach>" + + "</script>") + void delByGbStreams(List<GbStream> gbStreams); + + @Delete("<script> "+ + "DELETE from wvp_platform_gb_stream where platform_id=#{platformId} and gb_stream_id in " + + "<foreach collection='gbStreams' item='item' open='(' separator=',' close=')'>" + + "#{item.gbStreamId} " + + "</foreach>" + + "</script>") + void delByAppAndStreamsByPlatformId(@Param("gbStreams") List<GbStream> gbStreams, @Param("platformId") String platformId); + + @Delete("<script> "+ + "DELETE from wvp_platform_gb_stream WHERE platform_id=#{platformId}" + + " <if test='catalogId != null' > and catalog_id=#{catalogId}</if>" + + "</script>") + int delByPlatformAndCatalogId(@Param("platformId") String platformId, @Param("catalogId") String catalogId); } -- Gitblit v1.8.0