refactor(测试计划): 模块树count统计

This commit is contained in:
WangXu10 2024-05-17 17:34:55 +08:00 committed by Craftsman
parent d24611260c
commit 0164319960
2 changed files with 6 additions and 6 deletions

View File

@ -85,9 +85,9 @@
</select> </select>
<select id="selectIdByProjectIdAndTestPlanId" resultType="java.lang.String"> <select id="selectIdByProjectIdAndTestPlanId" resultType="java.lang.String">
SELECT tpm.id, tpm.project_id SELECT fcm.id, fcm.project_id
FROM test_plan_module tpm FROM functional_case_module fcm
WHERE tpm.id IN WHERE fcm.id IN
(SELECT fc.module_id FROM functional_case fc LEFT JOIN test_plan_functional_case tpfc ON tpfc.functional_case_id = fc.id WHERE tpfc.test_plan_id = #{testPlanId} AND fc.deleted = false and fc.project_id = #{projectId}) (SELECT fc.module_id FROM functional_case fc LEFT JOIN test_plan_functional_case tpfc ON tpfc.functional_case_id = fc.id WHERE tpfc.test_plan_id = #{testPlanId} AND fc.deleted = false and fc.project_id = #{projectId})
</select> </select>
</mapper> </mapper>

View File

@ -299,14 +299,14 @@ public class TestPlanFunctionalCaseService extends TestPlanResourceService {
List<BaseTreeNode> treeNodeList = this.getTreeOnlyIdsAndResourceCount(projectId, testPlanId, moduleCountDTOList); List<BaseTreeNode> treeNodeList = this.getTreeOnlyIdsAndResourceCount(projectId, testPlanId, moduleCountDTOList);
//通过广度遍历的方式构建返回值 //通过广度遍历的方式构建返回值
return testPlanModuleService.getIdCountMapByBreadth(treeNodeList); return functionalCaseModuleService.getIdCountMapByBreadth(treeNodeList);
} }
public List<BaseTreeNode> getTreeOnlyIdsAndResourceCount(String projectId, String testPlanId, List<ModuleCountDTO> moduleCountDTOList) { public List<BaseTreeNode> getTreeOnlyIdsAndResourceCount(String projectId, String testPlanId, List<ModuleCountDTO> moduleCountDTOList) {
//节点内容只有Id和parentId //节点内容只有Id和parentId
List<String> moduleIds = extTestPlanModuleMapper.selectIdByProjectIdAndTestPlanId(projectId, testPlanId); List<String> moduleIds = extTestPlanModuleMapper.selectIdByProjectIdAndTestPlanId(projectId, testPlanId);
List<BaseTreeNode> nodeByNodeIds = testPlanModuleService.getNodeByNodeIds(moduleIds); List<BaseTreeNode> nodeByNodeIds = functionalCaseModuleService.getNodeByNodeIds(moduleIds);
return testPlanModuleService.buildTreeAndCountResource(nodeByNodeIds, moduleCountDTOList, true, Translator.get("functional_case.module.default.name")); return functionalCaseModuleService.buildTreeAndCountResource(nodeByNodeIds, moduleCountDTOList, true, Translator.get("functional_case.module.default.name"));
} }