From 1dbb559b388831b5f15e690d0b33d24b1faaa983 Mon Sep 17 00:00:00 2001 From: 648540858 <648540858@qq.com> Date: 星期二, 25 一月 2022 15:43:52 +0800 Subject: [PATCH] 优化文件导入判断 --- src/main/java/com/genersoft/iot/vmp/storager/dao/PlatformGbStreamMapper.java | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++++++---- 1 files changed, 54 insertions(+), 4 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 aad93f6..a9f8510 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 @@ -1,6 +1,8 @@ package com.genersoft.iot.vmp.storager.dao; import com.genersoft.iot.vmp.gb28181.bean.GbStream; +import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform; +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 org.apache.ibatis.annotations.*; @@ -13,8 +15,8 @@ @Repository public interface PlatformGbStreamMapper { - @Insert("INSERT INTO platform_gb_stream (app, stream, platformId) VALUES" + - "('${app}', '${stream}', '${platformId}')") + @Insert("REPLACE INTO platform_gb_stream (app, stream, platformId, catalogId) VALUES" + + "('${app}', '${stream}', '${platformId}', '${catalogId}')") int add(PlatformGbStream platformGbStream); @Delete("DELETE FROM platform_gb_stream WHERE app=#{app} AND stream=#{stream}") @@ -23,6 +25,54 @@ @Delete("DELETE FROM platform_gb_stream WHERE platformId=#{platformId}") int delByPlatformId(String platformId); - @Select("SELECT * FROM platform_gb_stream WHERE app=#{app} AND stream=#{stream}") - List<StreamProxyItem> selectByAppAndStream(String app, String stream); + @Select("SELECT " + + "pp.* " + + "FROM " + + "platform_gb_stream pgs " + + "LEFT JOIN parent_platform pp ON pp.serverGBId = pgs.platformId " + + "WHERE " + + "pgs.app =#{app} " + + "AND pgs.stream =#{stream} " + + "GROUP BY pp.serverGBId") + List<ParentPlatform> selectByAppAndStream(String app, 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 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("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> queryChannelInParentPlatformAndCatalogForCatalog(String platformId, String catalogId); + + @Delete("DELETE FROM platform_gb_stream WHERE catalogId=#{id}") + int delByCatalogId(String id); + + @Select("<script> " + + "SELECT " + + "pp.* " + + "FROM " + + "parent_platform pp " + + "left join platform_gb_stream pgs on " + + "pp.serverGBId = pgs.platformId " + + "WHERE " + + "pgs.app = #{app} " + + "AND pgs.stream = #{stream}" + + "AND pp.serverGBId IN" + + "<foreach collection='platforms' item='item' open='(' separator=',' close=')' > #{item}</foreach>" + + "</script> ") + List<ParentPlatform> queryPlatFormListForGBWithGBId(String app, String stream, List<String> platforms); + + @Delete("DELETE FROM platform_gb_stream WHERE app=#{app} AND stream=#{stream} AND platformId=#{platformId}") + int delByAppAndStreamAndPlatform(String app, String stream, String platformId); } -- Gitblit v1.8.0