diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/service/impl/PlatformChannelServiceImpl.java b/src/main/java/com/genersoft/iot/vmp/gb28181/service/impl/PlatformChannelServiceImpl.java index 0fc89a20..1fe66e9c 100755 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/service/impl/PlatformChannelServiceImpl.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/service/impl/PlatformChannelServiceImpl.java @@ -99,7 +99,7 @@ public class PlatformChannelServiceImpl implements IPlatformChannelService { private Set deleteEmptyGroup(Set groupSet, Integer platformId) { for (Group group : groupSet) { // 获取分组子节点 - List children = platformChannelMapper.getShareChildrenGroup(group.getDeviceId(), platformId); + Set children = platformChannelMapper.queryShareChildrenGroup(group.getDeviceId(), platformId); if (!children.isEmpty()) { groupSet.remove(group); continue; @@ -112,11 +112,17 @@ public class PlatformChannelServiceImpl implements IPlatformChannelService { } platformChannelMapper.removePlatformGroupById(group.getId(), platformId); } - if (!groupSet.isEmpty()) { - + if (groupSet.isEmpty()) { + return new HashSet<>(); + } + Set parent = platformChannelMapper.queryShareParentGroupByGroupSet(groupSet, platformId); + if (parent.isEmpty()) { + return groupSet; + }else { + Set parentGroupSet = deleteEmptyGroup(parent, platformId); + groupSet.addAll(parentGroupSet); + return groupSet; } - - } private Set getAllGroup(Set groupList ) {