From 10f776678eeabfa0c73cf052db0e0044342f407f Mon Sep 17 00:00:00 2001
From: 648540858 <648540858@qq.com>
Date: 星期五, 25 二月 2022 20:33:38 +0800
Subject: [PATCH] Merge branch 'wvp-28181-2.0' into wvp-pro-record

---
 src/main/java/com/genersoft/iot/vmp/storager/dao/PlatformChannelMapper.java |   18 ++++++++++--------
 1 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/src/main/java/com/genersoft/iot/vmp/storager/dao/PlatformChannelMapper.java b/src/main/java/com/genersoft/iot/vmp/storager/dao/PlatformChannelMapper.java
index 4f5de2b..3df38fc 100644
--- a/src/main/java/com/genersoft/iot/vmp/storager/dao/PlatformChannelMapper.java
+++ b/src/main/java/com/genersoft/iot/vmp/storager/dao/PlatformChannelMapper.java
@@ -21,23 +21,23 @@
      * 鏌ヨ鍒楄〃閲屽凡缁忓叧鑱旂殑
      */
     @Select("<script> "+
-            "SELECT deviceAndChannelId FROM platform_gb_channel WHERE platformId='${platformId}' AND deviceAndChannelId in" +
-            "<foreach collection='deviceAndChannelIds' open='(' item='id_' separator=',' close=')'> '${id_}'</foreach> ORDER BY deviceAndChannelId ASC" +
+            "SELECT deviceChannelId FROM platform_gb_channel WHERE platformId='${platformId}' AND deviceChannelId in" +
+            "<foreach collection='channelReduces' open='(' item='item' separator=',' close=')'> '${item.id}'</foreach>" +
             "</script>")
-    List<String> findChannelRelatedPlatform(String platformId, List<String> deviceAndChannelIds);
+    List<Integer> findChannelRelatedPlatform(String platformId, List<ChannelReduce> channelReduces);
 
     @Insert("<script> "+
-            "INSERT INTO platform_gb_channel (channelId, deviceId, platformId, deviceAndChannelId, catalogId) VALUES" +
+            "INSERT INTO platform_gb_channel (platformId, deviceChannelId, catalogId) VALUES" +
             "<foreach collection='channelReducesToAdd'  item='item' separator=','>" +
-            " ('${item.channelId}','${item.deviceId}', '${platformId}', '${item.deviceId}_${item.channelId}' , '${item.catalogId}' )" +
+            " ('${platformId}', '${item.id}' , '${item.catalogId}' )" +
             "</foreach>" +
             "</script>")
     int addChannels(String platformId, List<ChannelReduce> channelReducesToAdd);
 
 
     @Delete("<script> "+
-            "DELETE FROM platform_gb_channel WHERE platformId='${platformId}' AND deviceAndChannelId in" +
-            "<foreach collection='channelReducesToDel'  item='item'  open='(' separator=',' close=')' > '${item.deviceId}_${item.channelId}'</foreach>" +
+            "DELETE FROM platform_gb_channel WHERE platformId='${platformId}' AND deviceChannelId in" +
+            "<foreach collection='channelReducesToDel'  item='item'  open='(' separator=',' close=')' > '${item.id}'</foreach>" +
             "</script>")
     int delChannelForGB(String platformId, List<ChannelReduce> channelReducesToDel);
 
@@ -82,8 +82,10 @@
             "parent_platform pp " +
             "left join platform_gb_channel pgc on " +
             "pp.serverGBId = pgc.platformId " +
+            "left join device_channel dc on " +
+            "dc.id = pgc.deviceChannelId " +
             "WHERE " +
-            "pgc.channelId = #{channelId} and pp.status = true " +
+            "dc.channelId = #{channelId} and pp.status = true " +
             "AND pp.serverGBId IN" +
             "<foreach collection='platforms'  item='item'  open='(' separator=',' close=')' > #{item}</foreach>" +
             "</script> ")

--
Gitblit v1.8.0