fix(测试计划): 左侧模块树统计问题
--bug=1047687 --user=宋昌昌 【测试计划】模块模式-模块树未展示用例数&模块脑图模式-脑图未展示用例数据 https://www.tapd.cn/55049933/s/1595659
This commit is contained in:
parent
1303986242
commit
07f6212eae
|
@ -680,7 +680,7 @@
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<select id="countModuleIdByRequest" resultType="io.metersphere.functional.dto.FunctionalCaseModuleCountDTO">
|
<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
|
count(atc.id) AS dataCount, atc.project_id AS projectId, project.name AS projectName
|
||||||
FROM test_plan_api_case t
|
FROM test_plan_api_case t
|
||||||
INNER JOIN api_test_case atc ON t.api_case_id = atc.id
|
INNER JOIN api_test_case atc ON t.api_case_id = atc.id
|
||||||
|
|
|
@ -426,7 +426,8 @@
|
||||||
|
|
||||||
|
|
||||||
<select id="countModuleIdByRequest" resultType="io.metersphere.functional.dto.FunctionalCaseModuleCountDTO">
|
<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
|
count(api_scenario.id) AS dataCount, api_scenario.project_id AS projectId, project.name AS projectName
|
||||||
FROM test_plan_api_scenario
|
FROM test_plan_api_scenario
|
||||||
INNER JOIN api_scenario on api_scenario.id = test_plan_api_scenario.api_scenario_id
|
INNER JOIN api_scenario on api_scenario.id = test_plan_api_scenario.api_scenario_id
|
||||||
|
|
|
@ -316,20 +316,10 @@
|
||||||
</include>
|
</include>
|
||||||
<!-- 所属模块(项目ID_模块ID 组合查询) -->
|
<!-- 所属模块(项目ID_模块ID 组合查询) -->
|
||||||
<if test="condition.name == 'moduleId'">
|
<if test="condition.name == 'moduleId'">
|
||||||
<choose>
|
<include refid="io.metersphere.system.mapper.BaseMapper.condition">
|
||||||
<when test="condition.operator == 'IN'">
|
<property name="condition" value="condition"/>
|
||||||
concat(functional_case.project_id, '_', functional_case.module_id) in
|
<property name="column" value="functional_case.module_id"/>
|
||||||
<foreach collection="condition.value" item="v" separator="," open="(" close=")">
|
</include>
|
||||||
#{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>
|
|
||||||
</if>
|
</if>
|
||||||
<!-- 测试点 -->
|
<!-- 测试点 -->
|
||||||
<if test="condition.name == 'testPlanCollectionId'">
|
<if test="condition.name == 'testPlanCollectionId'">
|
||||||
|
@ -569,7 +559,8 @@
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="countModuleIdByRequest" resultType="io.metersphere.functional.dto.FunctionalCaseModuleCountDTO">
|
<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
|
count(functional_case.id) As dataCount, functional_case.project_id As projectId, project.name As projectName
|
||||||
FROM test_plan_functional_case
|
FROM test_plan_functional_case
|
||||||
LEFT JOIN functional_case ON test_plan_functional_case.functional_case_id = functional_case.id
|
LEFT JOIN functional_case ON test_plan_functional_case.functional_case_id = functional_case.id
|
||||||
|
|
|
@ -513,7 +513,10 @@ public class TestPlanApiCaseService extends TestPlanResourceService {
|
||||||
}
|
}
|
||||||
List<BaseTreeNode> baseTreeNodes = apiDefinitionModuleService.buildTreeAndCountResource(nodeByNodeIds, needCreateRoot, Translator.get("api_unplanned_request"));
|
List<BaseTreeNode> baseTreeNodes = apiDefinitionModuleService.buildTreeAndCountResource(nodeByNodeIds, needCreateRoot, Translator.get("api_unplanned_request"));
|
||||||
for (BaseTreeNode baseTreeNode : baseTreeNodes) {
|
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);
|
projectNode.addChild(baseTreeNode);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -670,7 +670,10 @@ public class TestPlanApiScenarioService extends TestPlanResourceService {
|
||||||
}
|
}
|
||||||
List<BaseTreeNode> baseTreeNodes = apiScenarioModuleService.buildTreeAndCountResource(nodeByNodeIds, needCreateRoot, Translator.get("api_unplanned_scenario"));
|
List<BaseTreeNode> baseTreeNodes = apiScenarioModuleService.buildTreeAndCountResource(nodeByNodeIds, needCreateRoot, Translator.get("api_unplanned_scenario"));
|
||||||
for (BaseTreeNode baseTreeNode : baseTreeNodes) {
|
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);
|
projectNode.addChild(baseTreeNode);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -358,8 +358,10 @@ public class TestPlanFunctionalCaseService extends TestPlanResourceService {
|
||||||
}
|
}
|
||||||
List<BaseTreeNode> baseTreeNodes = functionalCaseModuleService.buildTreeAndCountResource(nodeByNodeIds, needCreatRoot, Translator.get("functional_case.module.default.name"));
|
List<BaseTreeNode> baseTreeNodes = functionalCaseModuleService.buildTreeAndCountResource(nodeByNodeIds, needCreatRoot, Translator.get("functional_case.module.default.name"));
|
||||||
for (BaseTreeNode baseTreeNode : baseTreeNodes) {
|
for (BaseTreeNode baseTreeNode : baseTreeNodes) {
|
||||||
// 节点ID, 拼接项目ID
|
if (StringUtils.equals(baseTreeNode.getId(), ModuleConstants.DEFAULT_NODE_ID)) {
|
||||||
baseTreeNode.setId(projectId + "_" + baseTreeNode.getId());
|
// 默认拼项目id
|
||||||
|
baseTreeNode.setId(projectId + "_" + ModuleConstants.DEFAULT_NODE_ID);
|
||||||
|
}
|
||||||
projectNode.addChild(baseTreeNode);
|
projectNode.addChild(baseTreeNode);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue