优化级联选择通道逻辑
This commit is contained in:
@@ -37,8 +37,10 @@ public interface GbStreamMapper {
|
||||
@Delete("DELETE FROM gb_stream WHERE app=#{app} AND stream=#{stream}")
|
||||
int del(String app, String stream);
|
||||
|
||||
@Select("SELECT gs.*, pgs.platformId AS platformId, pgs.catalogId AS catalogId FROM gb_stream gs LEFT JOIN platform_gb_stream pgs ON gs.app = pgs.app AND gs.stream = pgs.stream")
|
||||
List<GbStream> selectAll();
|
||||
@Select("SELECT gs.*, pgs.platformId AS platformId, pgs.catalogId AS catalogId FROM gb_stream gs " +
|
||||
"LEFT JOIN platform_gb_stream pgs ON gs.app = pgs.app AND gs.stream = pgs.stream " +
|
||||
"WHERE pgs.platformId is null OR pgs.platformId = #{platformId}")
|
||||
List<GbStream> selectAll(String platformId);
|
||||
|
||||
@Select("SELECT * FROM gb_stream WHERE app=#{app} AND stream=#{stream}")
|
||||
StreamProxyItem selectOne(String app, String stream);
|
||||
|
||||
@@ -24,7 +24,9 @@ public interface PlatformCatalogMapper {
|
||||
@Delete("DELETE FROM platform_catalog WHERE platformId=#{platformId}")
|
||||
int delByPlatformId(String platformId);
|
||||
|
||||
@Select("SELECT *, (SELECT COUNT(1) from platform_catalog where parentId = pc.id AND platformId=#{platformId}) as childrenCount FROM platform_catalog pc WHERE parentId=#{parentId} AND platformId=#{platformId}")
|
||||
@Select("SELECT pc.*, count(pc2.id) as childrenCount FROM platform_catalog pc " +
|
||||
"left join platform_catalog pc2 on pc.id = pc2.parentId " +
|
||||
"WHERE pc.parentId=#{parentId} AND pc.platformId=#{platformId} group by pc.id")
|
||||
List<PlatformCatalog> selectByParentId(String platformId, String parentId);
|
||||
|
||||
@Select("SELECT *, (SELECT COUNT(1) from platform_catalog where parentId = pc.id) as childrenCount FROM platform_catalog pc WHERE pc.id=#{id}")
|
||||
|
||||
@@ -83,7 +83,7 @@ public interface PlatformChannelMapper {
|
||||
"left join platform_gb_channel pgc on " +
|
||||
"pp.serverGBId = pgc.platformId " +
|
||||
"WHERE " +
|
||||
"pgc.channelId = #{channelId} " +
|
||||
"pgc.channelId = #{channelId} pp.status = true " +
|
||||
"AND pp.serverGBId IN" +
|
||||
"<foreach collection='platforms' item='item' open='(' separator=',' close=')' > #{item}</foreach>" +
|
||||
"</script> ")
|
||||
|
||||
@@ -52,8 +52,8 @@ public interface PlatformGbStreamMapper {
|
||||
"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);
|
||||
"where and 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);
|
||||
|
||||
@@ -639,7 +639,7 @@ public class VideoManagerStoragerImpl implements IVideoManagerStorager {
|
||||
|
||||
@Override
|
||||
public List<PlatformCatalog> queryStreamInParentPlatformAndCatalog(String platformId, String catalogId) {
|
||||
List<PlatformCatalog> catalogs = platformGbStreamMapper.queryChannelInParentPlatformAndCatalogForCatlog(platformId, catalogId);
|
||||
List<PlatformCatalog> catalogs = platformGbStreamMapper.queryChannelInParentPlatformAndCatalogForCatalog(platformId, catalogId);
|
||||
return catalogs;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user