diff --git a/framework/sdk-parent/sdk/src/main/java/io/metersphere/base/mapper/ext/BaseRelationshipEdgeMapper.xml b/framework/sdk-parent/sdk/src/main/java/io/metersphere/base/mapper/ext/BaseRelationshipEdgeMapper.xml index f073f1c778..e616291808 100644 --- a/framework/sdk-parent/sdk/src/main/java/io/metersphere/base/mapper/ext/BaseRelationshipEdgeMapper.xml +++ b/framework/sdk-parent/sdk/src/main/java/io/metersphere/base/mapper/ext/BaseRelationshipEdgeMapper.xml @@ -3,15 +3,19 @@ + diff --git a/framework/sdk-parent/sdk/src/main/java/io/metersphere/service/RelationshipEdgeService.java b/framework/sdk-parent/sdk/src/main/java/io/metersphere/service/RelationshipEdgeService.java index 5d9e34c05c..f558b17820 100644 --- a/framework/sdk-parent/sdk/src/main/java/io/metersphere/service/RelationshipEdgeService.java +++ b/framework/sdk-parent/sdk/src/main/java/io/metersphere/service/RelationshipEdgeService.java @@ -293,9 +293,11 @@ public class RelationshipEdgeService { if (CollectionUtils.isEmpty(graphIds)) { return new ArrayList<>(); } + RelationshipEdgeExample example = new RelationshipEdgeExample(); example.createCriteria() - .andGraphIdIn(graphIds); + .andGraphIdIn(graphIds.stream() + .distinct().collect(Collectors.toList())); return relationshipEdgeMapper.selectByExample(example); } @@ -319,7 +321,7 @@ public class RelationshipEdgeService { markSet.add(id); visitedSet.add(id); - ArrayList nextLevelNodes = new ArrayList(); + ArrayList nextLevelNodes = new ArrayList<>(); for (RelationshipEdge relationshipEdge : edges) { if (id.equals(relationshipEdge.getSourceId())) { nextLevelNodes.add(relationshipEdge.getTargetId());