fix(测试计划): 左侧模块树统计问题

--bug=1047687 --user=宋昌昌 【测试计划】模块模式-模块树未展示用例数&模块脑图模式-脑图未展示用例数据 https://www.tapd.cn/55049933/s/1595659
This commit is contained in:
song-cc-rock 2024-10-22 16:47:42 +08:00 committed by Craftsman
parent 1303986242
commit 07f6212eae
6 changed files with 21 additions and 21 deletions

View File

@ -680,7 +680,7 @@
</sql>
<select id="countModuleIdByRequest" resultType="io.metersphere.functional.dto.FunctionalCaseModuleCountDTO">
SELECT concat(atc.project_id, '_', a.module_id) as moduleId,
SELECT CASE WHEN a.module_id = 'root' THEN CONCAT(atc.project_id, '_', a.module_id) ELSE a.module_id END AS moduleId,
count(atc.id) AS dataCount, atc.project_id AS projectId, project.name AS projectName
FROM test_plan_api_case t
INNER JOIN api_test_case atc ON t.api_case_id = atc.id

View File

@ -426,7 +426,8 @@
<select id="countModuleIdByRequest" resultType="io.metersphere.functional.dto.FunctionalCaseModuleCountDTO">
SELECT concat(api_scenario.project_id, '_', api_scenario.module_id) as moduleId,
SELECT CASE WHEN api_scenario.module_id = 'root' THEN CONCAT(api_scenario.project_id, '_',
api_scenario.module_id) ELSE api_scenario.module_id END AS moduleId,
count(api_scenario.id) AS dataCount, api_scenario.project_id AS projectId, project.name AS projectName
FROM test_plan_api_scenario
INNER JOIN api_scenario on api_scenario.id = test_plan_api_scenario.api_scenario_id

View File

@ -316,20 +316,10 @@
</include>
<!-- 所属模块(项目ID_模块ID 组合查询) -->
<if test="condition.name == 'moduleId'">
<choose>
<when test="condition.operator == 'IN'">
concat(functional_case.project_id, '_', functional_case.module_id) in
<foreach collection="condition.value" item="v" separator="," open="(" close=")">
#{v}
</foreach>
</when>
<when test="condition.operator == 'NOT_IN'">
concat(functional_case.project_id, '_', functional_case.module_id) not in
<foreach collection="condition.value" item="v" separator="," open="(" close=")">
#{v}
</foreach>
</when>
</choose>
<include refid="io.metersphere.system.mapper.BaseMapper.condition">
<property name="condition" value="condition"/>
<property name="column" value="functional_case.module_id"/>
</include>
</if>
<!-- 测试点 -->
<if test="condition.name == 'testPlanCollectionId'">
@ -569,7 +559,8 @@
</select>
<select id="countModuleIdByRequest" resultType="io.metersphere.functional.dto.FunctionalCaseModuleCountDTO">
SELECT concat(functional_case.project_id, '_', functional_case.module_id) AS moduleId,
SELECT CASE WHEN functional_case.module_id = 'root' THEN concat(functional_case.project_id, '_',
functional_case.module_id) ElSE functional_case.module_id END AS moduleId,
count(functional_case.id) As dataCount, functional_case.project_id As projectId, project.name As projectName
FROM test_plan_functional_case
LEFT JOIN functional_case ON test_plan_functional_case.functional_case_id = functional_case.id

View File

@ -513,7 +513,10 @@ public class TestPlanApiCaseService extends TestPlanResourceService {
}
List<BaseTreeNode> baseTreeNodes = apiDefinitionModuleService.buildTreeAndCountResource(nodeByNodeIds, needCreateRoot, Translator.get("api_unplanned_request"));
for (BaseTreeNode baseTreeNode : baseTreeNodes) {
baseTreeNode.setId(projectId + "_" + baseTreeNode.getId());
if (StringUtils.equals(baseTreeNode.getId(), ModuleConstants.DEFAULT_NODE_ID)) {
// 默认拼项目id
baseTreeNode.setId(projectId + "_" + ModuleConstants.DEFAULT_NODE_ID);
}
projectNode.addChild(baseTreeNode);
}
});

View File

@ -670,7 +670,10 @@ public class TestPlanApiScenarioService extends TestPlanResourceService {
}
List<BaseTreeNode> baseTreeNodes = apiScenarioModuleService.buildTreeAndCountResource(nodeByNodeIds, needCreateRoot, Translator.get("api_unplanned_scenario"));
for (BaseTreeNode baseTreeNode : baseTreeNodes) {
baseTreeNode.setId(projectId + "_" + baseTreeNode.getId());
if (StringUtils.equals(baseTreeNode.getId(), ModuleConstants.DEFAULT_NODE_ID)) {
// 默认拼项目id
baseTreeNode.setId(projectId + "_" + ModuleConstants.DEFAULT_NODE_ID);
}
projectNode.addChild(baseTreeNode);
}
});

View File

@ -358,8 +358,10 @@ public class TestPlanFunctionalCaseService extends TestPlanResourceService {
}
List<BaseTreeNode> baseTreeNodes = functionalCaseModuleService.buildTreeAndCountResource(nodeByNodeIds, needCreatRoot, Translator.get("functional_case.module.default.name"));
for (BaseTreeNode baseTreeNode : baseTreeNodes) {
// 节点ID, 拼接项目ID
baseTreeNode.setId(projectId + "_" + baseTreeNode.getId());
if (StringUtils.equals(baseTreeNode.getId(), ModuleConstants.DEFAULT_NODE_ID)) {
// 默认拼项目id
baseTreeNode.setId(projectId + "_" + ModuleConstants.DEFAULT_NODE_ID);
}
projectNode.addChild(baseTreeNode);
}
});