From 1bfa2afbcba2054dc1714f5f8f0dfdef9d32c8cf Mon Sep 17 00:00:00 2001 From: fit2-zhao Date: Mon, 23 Dec 2024 10:26:14 +0800 Subject: [PATCH] =?UTF-8?q?perf(=E6=8E=A5=E5=8F=A3=E6=B5=8B=E8=AF=95):=20?= =?UTF-8?q?=E5=BC=95=E7=94=A8=E5=85=B3=E7=B3=BB=E5=9B=BE=E6=9F=A5=E8=AF=A2?= =?UTF-8?q?=20SQL=20=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../base/mapper/ext/BaseRelationshipEdgeMapper.xml | 8 ++++++-- .../io/metersphere/service/RelationshipEdgeService.java | 6 ++++-- 2 files changed, 10 insertions(+), 4 deletions(-) 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());