Bläddra i källkod

修复国标级联点播通道编号重复异常

648540858 1 år sedan
förälder
incheckning
de0ad2b32e

+ 3 - 2
src/main/java/com/genersoft/iot/vmp/gb28181/dao/PlatformChannelMapper.java

@@ -199,10 +199,10 @@ public interface PlatformChannelMapper {
             "    coalesce(wpgc.custom_svc_time_support_mode, wdc.gb_svc_time_support_mode, wdc.svc_time_support_mode) as gb_svc_time_support_mode\n" +
             " from wvp_device_channel wdc" +
             " left join wvp_platform_channel wpgc on wdc.id = wpgc.device_channel_id" +
-            " where wdc.channel_type = 0 and wpgc.platform_id = #{platformId} and coalesce(wpgc.custom_device_id, wdc.gb_device_id, wdc.device_id) = #{channelDeviceId}"
+            " where wdc.channel_type = 0 and wpgc.platform_id = #{platformId} and coalesce(wpgc.custom_device_id, wdc.gb_device_id, wdc.device_id) = #{channelDeviceId} order by wdc.id "
 
     )
-    CommonGBChannel queryOneWithPlatform(@Param("platformId") Integer platformId, @Param("channelDeviceId") String channelDeviceId);
+    List<CommonGBChannel> queryOneWithPlatform(@Param("platformId") Integer platformId, @Param("channelDeviceId") String channelDeviceId);
 
 
     @Select("<script>" +
@@ -306,6 +306,7 @@ public interface PlatformChannelMapper {
             "   #{item} " +
             "   </foreach> " +
             "</if>" +
+            " order by wdc.id" +
             "</script>")
     List<CommonGBChannel> queryShare(@Param("platformId") Integer platformId, List<Integer> channelIds);
 

+ 6 - 1
src/main/java/com/genersoft/iot/vmp/gb28181/service/impl/GbChannelServiceImpl.java

@@ -627,7 +627,12 @@ public class GbChannelServiceImpl implements IGbChannelService {
 
     @Override
     public CommonGBChannel queryOneWithPlatform(Integer platformId, String channelDeviceId) {
-        return platformChannelMapper.queryOneWithPlatform(platformId, channelDeviceId);
+        List<CommonGBChannel> channelList = platformChannelMapper.queryOneWithPlatform(platformId, channelDeviceId);
+        if (!channelList.isEmpty()) {
+            return channelList.get(channelList.size() - 1);
+        }else {
+            return null;
+        }
     }
 
     @Override