修复国标级联全部添加与全部删除

This commit is contained in:
648540858
2024-01-15 15:31:20 +08:00
parent 2b2efb59a6
commit 0371f5a96e
7 changed files with 30 additions and 24 deletions

View File

@@ -77,8 +77,6 @@ public class GbStreamServiceImpl implements IGbStreamService {
}
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 @@ public class GbStreamServiceImpl implements IGbStreamService {
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

View File

@@ -165,10 +165,9 @@ public class PlatformChannelServiceImpl implements IPlatformChannelService {
catalogId = null;
}
if ((result = platformChannelMapper.delChannelForGBByCatalogId(platformId, catalogId)) > 0) {
List<DeviceChannel> deviceChannels = platformChannelMapper.queryAllChannelInCatalog(platformId, catalogId);
eventPublisher.catalogEventPublish(platformId, deviceChannels, CatalogEvent.DEL);
}
return result;
List<DeviceChannel> deviceChannels = platformChannelMapper.queryAllChannelInCatalog(platformId, catalogId);
eventPublisher.catalogEventPublish(platformId, deviceChannels, CatalogEvent.DEL);
return platformChannelMapper.delChannelForGBByCatalogId(platformId, catalogId);
}
}