From f082797d9bf323084ebc6216c84eb00f05da868f Mon Sep 17 00:00:00 2001
From: panlinlin <648540858@qq.com>
Date: 星期三, 13 一月 2021 17:08:26 +0800
Subject: [PATCH] 完成向上级联->选择通道-003

---
 src/main/java/com/genersoft/iot/vmp/storager/dao/PatformChannelMapper.java |   37 +++++++++++++++++++++++++++++++++++++
 1 files changed, 37 insertions(+), 0 deletions(-)

diff --git a/src/main/java/com/genersoft/iot/vmp/storager/dao/PatformChannelMapper.java b/src/main/java/com/genersoft/iot/vmp/storager/dao/PatformChannelMapper.java
new file mode 100644
index 0000000..00b1260
--- /dev/null
+++ b/src/main/java/com/genersoft/iot/vmp/storager/dao/PatformChannelMapper.java
@@ -0,0 +1,37 @@
+package com.genersoft.iot.vmp.storager.dao;
+
+import com.genersoft.iot.vmp.vmanager.platform.bean.ChannelReduce;
+import org.apache.ibatis.annotations.Delete;
+import org.apache.ibatis.annotations.Insert;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Select;
+import org.springframework.stereotype.Repository;
+
+import java.util.List;
+
+@Mapper
+@Repository
+public interface PatformChannelMapper {
+
+    /**
+     * 鏌ヨ鍒楄〃閲屽凡缁忓叧鑱旂殑
+     */
+    @Select("<script> "+
+            "SELECT deviceAndChannelId FROM platform_gb_channel WHERE platformId='${platformId}' AND deviceAndChannelId in" +
+            "<foreach collection='deviceAndChannelIds' open='(' item='id_' separator=',' close=')'> '${id_}'</foreach>" +
+            "</script>")
+    List<String> findChannelRelatedPlatform(String platformId, List<String> deviceAndChannelIds);
+
+    @Insert("<script> "+
+            "INSERT INTO platform_gb_channel (channelId, deviceId, platformId, deviceAndChannelId) VALUES" +
+            "<foreach collection='channelReducesToAdd'  item='item' separator=','> ('${item.channelId}','${item.deviceId}', '${platformId}', '${item.deviceId}_${item.channelId}' )</foreach>" +
+            "</script>")
+    int addChannels(String platformId, List<ChannelReduce> channelReducesToAdd);
+
+
+    @Delete("<script> "+
+            "DELETE FROM platform_gb_channel WHERE deviceAndChannelId in" +
+            "<foreach collection='channelReducesToDel'  item='item'  open='(' separator=',' close=')' > '${item.deviceId}_${item.channelId}'</foreach>" +
+            "</script>")
+    int delChannelForGB(String platformId, List<ChannelReduce> channelReducesToDel);
+}

--
Gitblit v1.8.0