From 6d454423a2357df64d2f6993dac056c3c994ef97 Mon Sep 17 00:00:00 2001
From: ckb_test <745836797@qq.com>
Date: 星期一, 28 二月 2022 17:07:02 +0800
Subject: [PATCH] rPort 变更了HostAddres也要变

---
 src/main/java/com/genersoft/iot/vmp/storager/dao/PlatformChannelMapper.java |   26 +++++++++++++++-----------
 1 files changed, 15 insertions(+), 11 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 81f869c..6d3be95 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,22 @@
      * 鏌ヨ鍒楄〃閲屽凡缁忓叧鑱旂殑
      */
     @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);
 
@@ -51,11 +50,9 @@
             "</script>")
     int cleanChannelForGB(String platformId);
 
-
     @Select("SELECT * FROM device_channel WHERE deviceId = (SELECT deviceId FROM platform_gb_channel WHERE " +
             "platformId='${platformId}' AND channelId='${channelId}' ) AND channelId='${channelId}'")
     DeviceChannel queryChannelInParentPlatform(String platformId, String channelId);
-
 
     @Select("select dc.channelId as id, dc.name as name, pgc.platformId as platformId, pgc.catalogId as parentId, 0 as childrenCount, 1 as type " +
             "from device_channel dc left join platform_gb_channel pgc on dc.deviceId = pgc.deviceId and dc.channelId = pgc.channelId " +
@@ -82,10 +79,17 @@
             "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} 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> ")
     List<ParentPlatform> queryPlatFormListForGBWithGBId(String channelId, List<String> platforms);
+
+    @Delete("<script> " +
+           "DELETE FROM platform_gb_channel WHERE platformId=#{serverGBId}"  +
+           "</script>")
+    void delByPlatformId(String serverGBId);
 }

--
Gitblit v1.8.0