From fd71a96580d9180096f006bb16508349f0037f1b Mon Sep 17 00:00:00 2001 From: 648540858 <648540858@qq.com> Date: Wed, 15 Nov 2023 11:24:56 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=88=86=E7=BB=84=E6=A0=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../vmp/service/impl/CommonGbChannelServiceImpl.java | 8 ++++++-- .../iot/vmp/storager/dao/CommonGbChannelMapper.java | 12 ++++++++++-- .../vmanager/channel/CommonChannelController.java | 4 ++-- 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/genersoft/iot/vmp/service/impl/CommonGbChannelServiceImpl.java b/src/main/java/com/genersoft/iot/vmp/service/impl/CommonGbChannelServiceImpl.java index 7a98e62d..9021afbd 100644 --- a/src/main/java/com/genersoft/iot/vmp/service/impl/CommonGbChannelServiceImpl.java +++ b/src/main/java/com/genersoft/iot/vmp/service/impl/CommonGbChannelServiceImpl.java @@ -20,7 +20,6 @@ import com.github.pagehelper.PageInfo; import org.apache.commons.lang3.ObjectUtils; import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.math.NumberUtils; -import org.assertj.core.util.Lists; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -680,6 +679,11 @@ public class CommonGbChannelServiceImpl implements ICommonGbChannelService { @Override public void removeFromGroup(UpdateCommonChannelToGroup params) { - commonGbChannelMapper.removeFromGroup(params); + if (!params.getCommonGbIds().isEmpty()) { + commonGbChannelMapper.removeFromGroupByIds(params.getCommonGbIds()); + } + if (!ObjectUtils.isEmpty(params.getCommonGbBusinessGroupID().trim())){ + commonGbChannelMapper.removeFromGroupByGroupId(params.getCommonGbBusinessGroupID()); + } } } diff --git a/src/main/java/com/genersoft/iot/vmp/storager/dao/CommonGbChannelMapper.java b/src/main/java/com/genersoft/iot/vmp/storager/dao/CommonGbChannelMapper.java index 4db3d1af..2179d185 100644 --- a/src/main/java/com/genersoft/iot/vmp/storager/dao/CommonGbChannelMapper.java +++ b/src/main/java/com/genersoft/iot/vmp/storager/dao/CommonGbChannelMapper.java @@ -383,12 +383,20 @@ public interface CommonGbChannelMapper { void updateChannelToGroup(@Param("commonGbChannel") UpdateCommonChannelToGroup commonGbChannel); @Update({""}) - void removeFromGroup(@Param("commonGbChannel") UpdateCommonChannelToGroup commonGbChannel); + void removeFromGroupByIds(@Param("commonGbIds") List commonGbIds); + + @Update({""}) + void removeFromGroupByGroupId(@Param("commonGbBusinessGroupID") String commonGbBusinessGroupID); } diff --git a/src/main/java/com/genersoft/iot/vmp/vmanager/channel/CommonChannelController.java b/src/main/java/com/genersoft/iot/vmp/vmanager/channel/CommonChannelController.java index 5b280747..4a085efc 100755 --- a/src/main/java/com/genersoft/iot/vmp/vmanager/channel/CommonChannelController.java +++ b/src/main/java/com/genersoft/iot/vmp/vmanager/channel/CommonChannelController.java @@ -171,11 +171,11 @@ public class CommonChannelController { commonGbChannelService.updateChannelToGroup(params); } - @Operation(summary = "为通道添加分组") + @Operation(summary = "从分组中移除通道") @ResponseBody @PostMapping("/group/remove") public void removeFromGroup(@RequestBody UpdateCommonChannelToGroup params){ - assert params.getCommonGbBusinessGroupID() != null; + assert params.getCommonGbBusinessGroupID() != null || !params.getCommonGbIds().isEmpty(); commonGbChannelService.removeFromGroup(params); }