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 8c44f7b5e0..4da6213863 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
@@ -269,8 +269,6 @@
@@ -313,27 +309,27 @@
diff --git a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestPlanTestCaseMapper.xml b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestPlanTestCaseMapper.xml
index 312b04b00a..610854640d 100644
--- a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestPlanTestCaseMapper.xml
+++ b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestPlanTestCaseMapper.xml
@@ -552,9 +552,9 @@
select tcn.id, count(*) as caseNum, test_case.project_id
from test_plan_test_case
inner join test_case on test_plan_test_case.case_id = test_case.id
- inner join test_case_node tcn on test_case.node_id = tcn.id
+ left join test_case_node tcn on test_case.node_id = tcn.id
- group by test_case.node_id;
+ group by tcn.id;
diff --git a/backend/src/main/java/io/metersphere/service/NodeTreeService.java b/backend/src/main/java/io/metersphere/service/NodeTreeService.java
index 37d7db135c..d4d65e2208 100644
--- a/backend/src/main/java/io/metersphere/service/NodeTreeService.java
+++ b/backend/src/main/java/io/metersphere/service/NodeTreeService.java
@@ -158,6 +158,10 @@ public class NodeTreeService {
projectNode.setLabel(project.getName());
projectNode.setChildren(testCaseNodes);
projectNode.setCaseNum(testCaseNodes.stream().mapToInt(TreeNodeDTO::getCaseNum).sum());
+ if (countMap.get(null) != null) {
+ // 如果模块删除了, 回收站中的用例归到项目模块下
+ projectNode.setCaseNum(projectNode.getCaseNum() + countMap.get(null));
+ }
if (!org.springframework.util.CollectionUtils.isEmpty(testCaseNodes)) {
list.add(projectNode);
}
diff --git a/backend/src/main/java/io/metersphere/track/controller/TestCaseNodeController.java b/backend/src/main/java/io/metersphere/track/controller/TestCaseNodeController.java
index 0a2e2da65f..6b044c35d4 100644
--- a/backend/src/main/java/io/metersphere/track/controller/TestCaseNodeController.java
+++ b/backend/src/main/java/io/metersphere/track/controller/TestCaseNodeController.java
@@ -79,6 +79,11 @@ public class TestCaseNodeController {
return testCaseNodeService.getPublicCaseNode(workspaceId, request);
}
+ @PostMapping("/list/trash/{projectId}")
+ public List getTrashCaseNode(@PathVariable String projectId, @RequestBody QueryTestCaseRequest request) {
+ return testCaseNodeService.getTrashCaseNode(projectId, request);
+ }
+
@PostMapping("/list/plan/relate")
public List getRelatePlanNodes(@RequestBody QueryTestCaseRequest request) {
checkPermissionService.checkTestPlanOwner(request.getPlanId());
diff --git a/backend/src/main/java/io/metersphere/track/service/TestCaseNodeService.java b/backend/src/main/java/io/metersphere/track/service/TestCaseNodeService.java
index b73eed0466..f4510f9416 100644
--- a/backend/src/main/java/io/metersphere/track/service/TestCaseNodeService.java
+++ b/backend/src/main/java/io/metersphere/track/service/TestCaseNodeService.java
@@ -144,16 +144,6 @@ public class TestCaseNodeService extends NodeTreeService {
return getNodeTreeByProjectId(projectId, new QueryTestCaseRequest());
}
- public List getNodeTreeByProjectId(String projectId, QueryTestCaseRequest request) {
- // 判断当前项目下是否有默认模块,没有添加默认模块
- this.getDefaultNode(projectId);
- request.setProjectId(projectId);
- request.setUserId(SessionUtils.getUserId());
- List countMNodes = extTestCaseMapper.getCountNodes(request);
- List testCaseNodes = extTestCaseNodeMapper.getNodeTreeByProjectId(projectId);
- return getNodeTrees(testCaseNodes, getCountMap(countMNodes));
- }
-
private Map parseModuleCountList(List