From ee740ad063b936265781b4cbd7340fc2c2ce796d Mon Sep 17 00:00:00 2001 From: song-cc-rock Date: Thu, 18 Aug 2022 16:54:43 +0800 Subject: [PATCH] =?UTF-8?q?refactor(=E6=B5=8B=E8=AF=95=E8=B7=9F=E8=B8=AA):?= =?UTF-8?q?=20=E5=9B=9E=E6=94=B6=E7=AB=99=E5=B7=A6=E4=BE=A7=E6=A8=A1?= =?UTF-8?q?=E5=9D=97=E6=A0=91=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --task=1008552 --bug=1015939,1015927,1015930 --user=宋昌昌 https://www.tapd.cn/55049933/s/1226931 https://www.tapd.cn/55049933/s/1226965 https://www.tapd.cn/55049933/s/1226980 --- .../base/mapper/ext/ExtTestCaseMapper.java | 2 + .../base/mapper/ext/ExtTestCaseMapper.xml | 12 ++++++ .../track/service/TestCaseNodeService.java | 3 ++ .../components/search/MsTableAdvSearchBar.vue | 3 ++ .../components/track/case/TestCase.vue | 15 +++++++- .../track/case/components/TestCaseList.vue | 38 ++++++++++++++++--- .../track/module/TestCaseTrashNodeTree.vue | 6 ++- 7 files changed, 71 insertions(+), 8 deletions(-) diff --git a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestCaseMapper.java b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestCaseMapper.java index 6605adda9e..4897d9dac2 100644 --- a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestCaseMapper.java +++ b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTestCaseMapper.java @@ -164,4 +164,6 @@ public interface ExtTestCaseMapper { int bathUpdateByCondition(@Param("request") QueryTestCaseRequest condition, @Param("record") TestCaseWithBLOBs testCaseWithBLOBs); List getWorkspaceCountNodes(@Param("request") QueryTestCaseRequest request); + + void updateNoModuleTrashNodeToDefault(@Param("projectId") String projectId, @Param("defaultNodeId") String defaultNodeId, @Param("defaultNodePath") String defaultNodePath); } 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 89ee022465..40b2902244 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 @@ -1351,4 +1351,16 @@ and p.workspace_id = #{request.workspaceId} group by tcn.id; + + + update test_case + set node_id = #{defaultNodeId}, + node_path = #{defaultNodePath} + where project_id = #{projectId} + and status = 'Trash' + and latest = true + and node_id not in ( + select id from test_case_node where project_id = #{projectId} + ) + 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 a11a979644..3d60c7fbee 100644 --- a/backend/src/main/java/io/metersphere/track/service/TestCaseNodeService.java +++ b/backend/src/main/java/io/metersphere/track/service/TestCaseNodeService.java @@ -280,6 +280,9 @@ public class TestCaseNodeService extends NodeTreeService { } public List getTrashCaseNode(String projectId, QueryTestCaseRequest request) { + // 初始化回收站中模块被删除的用例, 挂在默认未规划模块, 获取回收站模块节点数据 + TestCaseNode defaultNode = this.getDefaultNode(projectId); + extTestCaseMapper.updateNoModuleTrashNodeToDefault(projectId, defaultNode.getId(), defaultNode.getName()); request.setProjectId(projectId); request.setNodeIds(null); List countModules = extTestCaseMapper.getCountNodes(request); diff --git a/frontend/src/business/components/common/components/search/MsTableAdvSearchBar.vue b/frontend/src/business/components/common/components/search/MsTableAdvSearchBar.vue index 879a0faedb..6133dca975 100644 --- a/frontend/src/business/components/common/components/search/MsTableAdvSearchBar.vue +++ b/frontend/src/business/components/common/components/search/MsTableAdvSearchBar.vue @@ -125,6 +125,9 @@ export default { condition['customs'] = []; } let value = component.value; + if (component.label === '用例状态' && value.length === 1 && value.indexOf('Trash') > -1) { + return; + } if (component.type === "multipleMember" || component.type === "checkbox" || component.type === "multipleSelect") { try { value = JSON.stringify(component.value); diff --git a/frontend/src/business/components/track/case/TestCase.vue b/frontend/src/business/components/track/case/TestCase.vue index 1f374add7b..a49fcfa45e 100644 --- a/frontend/src/business/components/track/case/TestCase.vue +++ b/frontend/src/business/components/track/case/TestCase.vue @@ -39,7 +39,7 @@ - +