diff --git a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestCaseMapper.xml b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestCaseMapper.xml
index 9be0c73bfb..55bfae6453 100644
--- a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestCaseMapper.xml
+++ b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestCaseMapper.xml
@@ -566,6 +566,7 @@
#{id}
+ and test_case.status != 'Trash';
diff --git a/backend/src/main/java/io/metersphere/dto/RelationshipGraphData.java b/backend/src/main/java/io/metersphere/dto/RelationshipGraphData.java
index cae68ccdf1..de6176a7a3 100644
--- a/backend/src/main/java/io/metersphere/dto/RelationshipGraphData.java
+++ b/backend/src/main/java/io/metersphere/dto/RelationshipGraphData.java
@@ -1,8 +1,11 @@
package io.metersphere.dto;
+import lombok.AllArgsConstructor;
import lombok.Getter;
+import lombok.NoArgsConstructor;
import lombok.Setter;
+import java.util.ArrayList;
import java.util.List;
@Getter
@@ -12,12 +15,18 @@ public class RelationshipGraphData {
private List data;
private List links;
+ public RelationshipGraphData() {
+ this.data = new ArrayList<>();
+ this.links = new ArrayList<>();
+ }
+
@Getter
@Setter
public static class Node {
private String id;
private Integer index;
private String name;
+ private Boolean highlight;
private Integer x;
private Integer y;
}
@@ -28,4 +37,16 @@ public class RelationshipGraphData {
private Integer source;
private Integer target;
}
+
+ /**
+ * 记录当前遍历时,已经占用的 x 坐标的最大最小值
+ */
+ @Getter
+ @Setter
+ @NoArgsConstructor
+ @AllArgsConstructor
+ public static class XAxisMark {
+ private Integer min;
+ private Integer max;
+ }
}
diff --git a/backend/src/main/java/io/metersphere/service/RelationshipEdgeService.java b/backend/src/main/java/io/metersphere/service/RelationshipEdgeService.java
index a52ebd4aeb..852cf7fc9a 100644
--- a/backend/src/main/java/io/metersphere/service/RelationshipEdgeService.java
+++ b/backend/src/main/java/io/metersphere/service/RelationshipEdgeService.java
@@ -39,6 +39,24 @@ public class RelationshipEdgeService {
relationshipEdgeMapper.deleteByExample(example);
}
+ public void delete(String sourceIdOrTargetId) {
+ RelationshipEdgeExample example = new RelationshipEdgeExample();
+ example.createCriteria()
+ .andSourceIdEqualTo(sourceIdOrTargetId);
+ example.or(example.createCriteria()
+ .andTargetIdEqualTo(sourceIdOrTargetId));
+ relationshipEdgeMapper.deleteByExample(example);
+ }
+
+ public void delete(List sourceIdOrTargetIds) {
+ RelationshipEdgeExample example = new RelationshipEdgeExample();
+ example.createCriteria()
+ .andSourceIdIn(sourceIdOrTargetIds);
+ example.or(example.createCriteria()
+ .andTargetIdIn(sourceIdOrTargetIds));
+ relationshipEdgeMapper.deleteByExample(example);
+ }
+
public List getBySourceId(String sourceId) {
RelationshipEdgeExample example = new RelationshipEdgeExample();
example.createCriteria()
diff --git a/backend/src/main/java/io/metersphere/track/service/TestCaseService.java b/backend/src/main/java/io/metersphere/track/service/TestCaseService.java
index cf4ebb1259..4ca7260c3c 100644
--- a/backend/src/main/java/io/metersphere/track/service/TestCaseService.java
+++ b/backend/src/main/java/io/metersphere/track/service/TestCaseService.java
@@ -325,6 +325,7 @@ public class TestCaseService {
examples.createCriteria().andTestCaseIdEqualTo(testCaseId);
testCaseTestMapper.deleteByExample(examples);
relateDelete(testCaseId);
+ relationshipEdgeService.delete(testCaseId); // 删除关系图
return testCaseMapper.deleteByPrimaryKey(testCaseId);
}
@@ -1237,6 +1238,17 @@ public class TestCaseService {
public void deleteTestCaseBath(TestCaseBatchRequest request) {
TestCaseExample example = this.getBatchExample(request);
deleteTestPlanTestCaseBath(request.getIds());
+ relationshipEdgeService.delete(request.getIds()); // 删除关系图
+
+ request.getIds().forEach(testCaseId -> { // todo 优化下效率
+ testCaseIssueService.delTestCaseIssues(testCaseId);
+ testCaseCommentService.deleteCaseComment(testCaseId);
+ TestCaseTestExample examples = new TestCaseTestExample();
+ examples.createCriteria().andTestCaseIdEqualTo(testCaseId);
+ testCaseTestMapper.deleteByExample(examples);
+ relateDelete(testCaseId);
+ });
+
testCaseMapper.deleteByExample(example);
}
@@ -1810,7 +1822,6 @@ public class TestCaseService {
}
public void deleteToGcBatch(TestCaseBatchRequest request) {
- TestCaseExample example = this.getBatchExample(request);
if (CollectionUtils.isNotEmpty(request.getIds())) {
for (String id : request.getIds()) {
this.deleteTestCaseToGc(id);
diff --git a/backend/src/main/java/io/metersphere/xpack b/backend/src/main/java/io/metersphere/xpack
index 8eb2b79893..98bc55c104 160000
--- a/backend/src/main/java/io/metersphere/xpack
+++ b/backend/src/main/java/io/metersphere/xpack
@@ -1 +1 @@
-Subproject commit 8eb2b79893a70986d06f47ffeac9c6ae12e6fff7
+Subproject commit 98bc55c1045fb8abc2ca0131bedaf9be69be4919
diff --git a/frontend/src/business/components/track/case/TestCase.vue b/frontend/src/business/components/track/case/TestCase.vue
index 71e82c9687..d8b7671d67 100644
--- a/frontend/src/business/components/track/case/TestCase.vue
+++ b/frontend/src/business/components/track/case/TestCase.vue
@@ -8,6 +8,7 @@
@setTreeNodes="setTreeNodes"
@exportTestCase="exportTestCase"
@saveAsEdit="editTestCase"
+ @openGraph="openGraph"
:show-operator="true"
@createCase="handleCaseSimpleCreate($event, 'add')"
@refreshAll="refreshAll"
@@ -323,6 +324,9 @@ export default {
}
this.$refs.testCaseList.exportTestCase(type);
},
+ openGraph() {
+ this.$refs.testCaseList.generateGraph();
+ },
addListener() {
let index = this.tabs.findIndex(item => item.name === this.activeName); // 找到当前选中tab的index
if (index != -1) { // 为当前选中的tab添加监听
diff --git a/frontend/src/business/components/track/case/components/TestCaseDependencies.vue b/frontend/src/business/components/track/case/components/TestCaseDependencies.vue
index fc307589e0..60ed5197e2 100644
--- a/frontend/src/business/components/track/case/components/TestCaseDependencies.vue
+++ b/frontend/src/business/components/track/case/components/TestCaseDependencies.vue
@@ -15,7 +15,7 @@