Commit b97db305eb110da024e2e5c922e31f8665d65520

Authored by luoshuyue
1 parent a42dda2b

修复了拉流添加国标编码上级级联调取不到视频的bug

sql/mysql.sql
... ... @@ -389,7 +389,7 @@ DROP TABLE IF EXISTS `platform_gb_stream`;
389 389 CREATE TABLE `platform_gb_stream` (
390 390 `platformId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
391 391 `catalogId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
392   - `gbStreamId` int NOT NULL,
  392 + `gbStreamId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
393 393 `id` int NOT NULL AUTO_INCREMENT,
394 394 PRIMARY KEY (`id`),
395 395 UNIQUE KEY `platform_gb_stream_pk` (`platformId`,`catalogId`,`gbStreamId`)
... ...
src/main/java/com/genersoft/iot/vmp/storager/dao/GbStreamMapper.java
... ... @@ -41,15 +41,15 @@ public interface GbStreamMapper {
41 41 "SELECT gs.* FROM gb_stream gs " +
42 42 "WHERE " +
43 43 "1=1 " +
44   - " <if test='catalogId != null'> AND gs.gbStreamId in" +
  44 + " <if test='catalogId != null'> AND gs.gbId in" +
45 45 "(select pgs.gbStreamId from platform_gb_stream pgs where pgs.platformId = #{platformId} and pgs.catalogId=#{catalogId})</if> " +
46   - " <if test='catalogId == null'> AND gs.gbStreamId not in" +
  46 + " <if test='catalogId == null'> AND gs.gbId not in" +
47 47 "(select pgs.gbStreamId from platform_gb_stream pgs where pgs.platformId = #{platformId}) </if> " +
48 48 " <if test='query != null'> AND (gs.app LIKE '%${query}%' OR gs.stream LIKE '%${query}%' OR gs.gbId LIKE '%${query}%' OR gs.name LIKE '%${query}%')</if> " +
49 49 " <if test='pushing == true' > AND gs.status=1</if>" +
50 50 " <if test='pushing == false' > AND gs.status=0</if>" +
51 51 " <if test='mediaServerId != null' > AND gs.mediaServerId=#{mediaServerId} </if>" +
52   - " order by gs.gbStreamId asc " +
  52 + " order by gs.gbId asc " +
53 53 "</script>")
54 54 List<GbStream> selectAll(String platformId, String catalogId, String query, Boolean pushing, String mediaServerId);
55 55  
... ... @@ -60,18 +60,18 @@ public interface GbStreamMapper {
60 60 List<GbStream> selectByGBId(String gbId);
61 61  
62 62 @Select("SELECT gs.*, pgs.platformId as platformId, pgs.catalogId as catalogId FROM gb_stream gs " +
63   - "LEFT JOIN platform_gb_stream pgs ON gs.gbStreamId = pgs.catalogId " +
  63 + "LEFT JOIN platform_gb_stream pgs ON gs.gbId = pgs.gbStreamId " +
64 64 "WHERE gs.gbId = '${gbId}' AND pgs.platformId = '${platformId}'")
65 65 GbStream queryStreamInPlatform(String platformId, String gbId);
66 66  
67 67 @Select("SELECT gs.*, pgs.platformId as platformId, pgs.catalogId as catalogId FROM gb_stream gs " +
68   - "LEFT JOIN platform_gb_stream pgs ON gs.gbStreamId = pgs.gbStreamId " +
  68 + "LEFT JOIN platform_gb_stream pgs ON gs.gbId = pgs.gbStreamId " +
69 69 "WHERE pgs.platformId = #{platformId}")
70 70 List<GbStream> queryGbStreamListInPlatform(String platformId);
71 71  
72 72  
73 73 @Select("SELECT gs.* FROM gb_stream gs LEFT JOIN platform_gb_stream pgs " +
74   - "ON gs.gbStreamId = pgs.gbStreamId WHERE pgs.gbStreamId is NULL")
  74 + "ON gs.gbId = pgs.gbStreamId WHERE pgs.gbStreamId is NULL")
75 75 List<GbStream> queryStreamNotInPlatform();
76 76  
77 77 @Update("UPDATE gb_stream " +
... ... @@ -128,10 +128,10 @@ public interface GbStreamMapper {
128 128 int updateStreamGPS(List<GPSMsgInfo> gpsMsgInfos);
129 129  
130 130 @Select("<script> "+
131   - "SELECT * FROM gb_stream where " +
132   - "<foreach collection='streamPushItems' item='item' separator='or'>" +
133   - "(app=#{item.app} and stream=#{item.stream}) " +
134   - "</foreach>" +
135   - "</script>")
  131 + "SELECT * FROM gb_stream where " +
  132 + "<foreach collection='streamPushItems' item='item' separator='or'>" +
  133 + "(app=#{item.app} and stream=#{item.stream}) " +
  134 + "</foreach>" +
  135 + "</script>")
136 136 List<GbStream> selectAllForAppAndStream(List<StreamPushItem> streamPushItems);
137 137 }
... ...
src/main/java/com/genersoft/iot/vmp/storager/dao/PlatformGbStreamMapper.java
... ... @@ -17,7 +17,7 @@ import java.util.List;
17 17 public interface PlatformGbStreamMapper {
18 18  
19 19 @Insert("REPLACE INTO platform_gb_stream (gbStreamId, platformId, catalogId) VALUES" +
20   - "( #{gbStreamId}, #{platformId}, #{catalogId})")
  20 + "( #{gbId}, #{platformId}, #{catalogId})")
21 21 int add(PlatformGbStream platformGbStream);
22 22  
23 23  
... ... @@ -26,12 +26,12 @@ public interface PlatformGbStreamMapper {
26 26 "(gbStreamId, platformId, catalogId) " +
27 27 "values " +
28 28 "<foreach collection='streamPushItems' index='index' item='item' separator=','> " +
29   - "(${item.gbStreamId}, '${item.platformId}', '${item.catalogId}')" +
  29 + "(#{item.gbId}, #{item.platformId}, #{item.catalogId})" +
30 30 "</foreach> " +
31 31 "</script>")
32 32 int batchAdd(List<StreamPushItem> streamPushItems);
33 33  
34   - @Delete("DELETE FROM platform_gb_stream WHERE gbStreamId = (select gbStreamId from gb_stream where app=#{app} AND stream=#{stream})")
  34 + @Delete("DELETE FROM platform_gb_stream WHERE gbStreamId = (select gbId from gb_stream where app=#{app} AND stream=#{stream})")
35 35 int delByAppAndStream(String app, String stream);
36 36  
37 37 @Delete("DELETE FROM platform_gb_stream WHERE platformId=#{platformId}")
... ... @@ -42,28 +42,28 @@ public interface PlatformGbStreamMapper {
42 42 "FROM " +
43 43 "platform_gb_stream pgs " +
44 44 "LEFT JOIN parent_platform pp ON pp.serverGBId = pgs.platformId " +
45   - "LEFT JOIN gb_stream gs ON gs.gbStreamId = pgs.gbStreamId " +
  45 + "LEFT JOIN gb_stream gs ON gs.gbId = pgs.gbStreamId " +
46 46 "WHERE " +
47 47 "gs.app =#{app} " +
48 48 "AND gs.stream =#{stream} ")
49 49 List<ParentPlatform> selectByAppAndStream(String app, String stream);
50 50  
51 51 @Select("SELECT pgs.*, gs.gbId FROM platform_gb_stream pgs " +
52   - "LEFT JOIN gb_stream gs ON pgs.gbStreamId = gs.gbStreamId " +
  52 + "LEFT JOIN gb_stream gs ON pgs.gbStreamId = gs.gbId " +
53 53 "WHERE gs.app=#{app} AND gs.stream=#{stream} AND pgs.platformId=#{serverGBId}")
54 54 StreamProxyItem selectOne(String app, String stream, String serverGBId);
55 55  
56 56 @Select("select gs.* \n" +
57 57 "from gb_stream gs\n" +
58 58 " left join platform_gb_stream pgs\n" +
59   - " on gs.gbStreamId = pgs.gbStreamId\n" +
  59 + " on gs.gbId = pgs.gbStreamId\n" +
60 60 "where pgs.platformId=#{platformId} and pgs.catalogId=#{catalogId}")
61 61 List<GbStream> queryChannelInParentPlatformAndCatalog(String platformId, String catalogId);
62 62  
63 63 @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" +
64 64 "from gb_stream gs\n" +
65 65 " left join platform_gb_stream pgs\n" +
66   - " on gs.gbStreamId = pgs.gbStreamId\n" +
  66 + " on gs.gbId = pgs.gbStreamId\n" +
67 67 "where pgs.platformId=#{platformId} and pgs.catalogId=#{catalogId}")
68 68 List<PlatformCatalog> queryChannelInParentPlatformAndCatalogForCatalog(String platformId, String catalogId);
69 69  
... ... @@ -78,7 +78,7 @@ public interface PlatformGbStreamMapper {
78 78 "left join platform_gb_stream pgs on " +
79 79 "pp.serverGBId = pgs.platformId " +
80 80 "left join gb_stream gs " +
81   - "gs.gbStreamId = pgs.gbStreamId " +
  81 + "gs.gbId = pgs.gbStreamId " +
82 82 "WHERE " +
83 83 "gs.app = #{app} " +
84 84 "AND gs.stream = #{stream}" +
... ... @@ -87,13 +87,13 @@ public interface PlatformGbStreamMapper {
87 87 "</script> ")
88 88 List<ParentPlatform> queryPlatFormListForGBWithGBId(String app, String stream, List<String> platforms);
89 89  
90   - @Delete("DELETE FROM platform_gb_stream WHERE gbStreamId = (select id from gb_stream where app=#{app} AND stream=#{stream}) AND platformId=#{platformId}")
  90 + @Delete("DELETE FROM platform_gb_stream WHERE gbStreamId = (select gbId from gb_stream where app=#{app} AND stream=#{stream}) AND platformId=#{platformId}")
91 91 int delByAppAndStreamAndPlatform(String app, String stream, String platformId);
92 92  
93 93 @Delete("<script> "+
94 94 "DELETE FROM platform_gb_stream where gbStreamId in " +
95 95 "<foreach collection='gbStreams' item='item' open='(' separator=',' close=')' >" +
96   - "#{item.gbStreamId}" +
  96 + "#{item.gbId}" +
97 97 "</foreach>" +
98 98 "</script>")
99 99 void delByGbStreams(List<GbStream> gbStreams);
... ... @@ -101,7 +101,7 @@ public interface PlatformGbStreamMapper {
101 101 @Delete("<script> "+
102 102 "DELETE FROM platform_gb_stream where platformId=#{platformId} and gbStreamId in " +
103 103 "<foreach collection='gbStreams' item='item' open='(' separator=',' close=')'>" +
104   - "#{item.gbStreamId} " +
  104 + "#{item.gbId} " +
105 105 "</foreach>" +
106 106 "</script>")
107 107 void delByAppAndStreamsByPlatformId(List<GbStream> gbStreams, String platformId);
... ...
src/main/java/com/genersoft/iot/vmp/storager/impl/VideoManagerStoragerImpl.java
... ... @@ -707,7 +707,7 @@ public class VideoManagerStoragerImpl implements IVideoManagerStorager {
707 707 try {
708 708 if (streamProxyMapper.add(streamProxyItem) > 0) {
709 709 if (!StringUtils.isEmpty(streamProxyItem.getGbId())) {
710   - if (gbStreamMapper.add(streamProxyItem) > 0) {
  710 + if (gbStreamMapper.add(streamProxyItem) < 0) {
711 711 //事务回滚
712 712 dataSourceTransactionManager.rollback(transactionStatus);
713 713 return false;
... ... @@ -742,7 +742,7 @@ public class VideoManagerStoragerImpl implements IVideoManagerStorager {
742 742 try {
743 743 if (streamProxyMapper.update(streamProxyItem) > 0) {
744 744 if (!StringUtils.isEmpty(streamProxyItem.getGbId())) {
745   - if (gbStreamMapper.update(streamProxyItem) > 0) {
  745 + if (gbStreamMapper.update(streamProxyItem) < 0) {
746 746 //事务回滚
747 747 dataSourceTransactionManager.rollback(transactionStatus);
748 748 return false;
... ...