From 0371f5a96e8be9067b796c7b93ecf4d3bbdb99dc Mon Sep 17 00:00:00 2001 From: 648540858 <648540858@qq.com> Date: 星期一, 15 一月 2024 15:31:20 +0800 Subject: [PATCH] 修复国标级联全部添加与全部删除 --- src/main/java/com/genersoft/iot/vmp/service/impl/GbStreamServiceImpl.java | 22 +++++++++++----------- 1 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/main/java/com/genersoft/iot/vmp/service/impl/GbStreamServiceImpl.java b/src/main/java/com/genersoft/iot/vmp/service/impl/GbStreamServiceImpl.java index 86e033c..49e4a3c 100755 --- a/src/main/java/com/genersoft/iot/vmp/service/impl/GbStreamServiceImpl.java +++ b/src/main/java/com/genersoft/iot/vmp/service/impl/GbStreamServiceImpl.java @@ -77,8 +77,6 @@ } try { List<DeviceChannel> deviceChannelList = new ArrayList<>(); - - for (int i = 0; i < gbStreams.size(); i++) { GbStream gbStream = gbStreams.get(i); gbStream.setCatalogId(catalogId); @@ -250,16 +248,18 @@ if (platform == null) { return ; } - if (platformGbStreamMapper.delByPlatformAndCatalogId(platformId, catalogId) > 0) { - List<GbStream> gbStreams = platformGbStreamMapper.queryChannelInParentPlatformAndCatalog(platformId, catalogId); - List<DeviceChannel> deviceChannelList = new ArrayList<>(); - for (GbStream gbStream : gbStreams) { - DeviceChannel deviceChannel = new DeviceChannel(); - deviceChannel.setChannelId(gbStream.getGbId()); - deviceChannelList.add(deviceChannel); - } - eventPublisher.catalogEventPublish(platformId, deviceChannelList, CatalogEvent.DEL); + if (ObjectUtils.isEmpty(catalogId)) { + catalogId = null; } + List<GbStream> gbStreams = platformGbStreamMapper.queryChannelInParentPlatformAndCatalog(platformId, catalogId); + List<DeviceChannel> deviceChannelList = new ArrayList<>(); + for (GbStream gbStream : gbStreams) { + DeviceChannel deviceChannel = new DeviceChannel(); + deviceChannel.setChannelId(gbStream.getGbId()); + deviceChannelList.add(deviceChannel); + } + eventPublisher.catalogEventPublish(platformId, deviceChannelList, CatalogEvent.DEL); + platformGbStreamMapper.delByPlatformAndCatalogId(platformId, catalogId); } @Override -- Gitblit v1.8.0