fix(测试计划): 修复测试计划数量统计的错误

This commit is contained in:
song-tianyang 2024-05-29 00:31:47 +08:00 committed by Craftsman
parent 0654c732db
commit a5c0ed37ec
3 changed files with 6 additions and 8 deletions

View File

@ -21,7 +21,7 @@ public interface ExtTestPlanMapper {
List<String> selectGroupIdByConditions(TestPlanQueryConditions testPlanQueryConditions); List<String> selectGroupIdByConditions(TestPlanQueryConditions testPlanQueryConditions);
List<ModuleCountDTO> countModuleIdByConditions(TestPlanQueryConditions testPlanQueryConditions); List<ModuleCountDTO> countModuleIdByConditions(@Param("request") TestPlanTableRequest testPlanQueryConditions);
List<TestPlan> selectBaseInfoByIds(@Param("list") List<String> deleteIdList); List<TestPlan> selectBaseInfoByIds(@Param("list") List<String> deleteIdList);

View File

@ -242,13 +242,12 @@
<select id="countModuleIdByConditions" <select id="countModuleIdByConditions"
parameterType="io.metersphere.plan.dto.TestPlanQueryConditions"
resultType="io.metersphere.project.dto.ModuleCountDTO"> resultType="io.metersphere.project.dto.ModuleCountDTO">
SELECT t.module_id AS moduleId, count(distinct t.id) AS dataCount SELECT t.module_id AS moduleId, count(t.id) AS dataCount
FROM test_plan t FROM test_plan t
INNER JOIN user createUser ON t.create_user = createUser.id INNER JOIN user createUser ON t.create_user = createUser.id
INNER JOIN test_plan_module tpm on (tpm.id = t.module_id or t.module_id = 'root') WHERE t.project_id = #{request.projectId}
<include refid="test_plan_page_request"/> <include refid="queryWhereCondition"/>
GROUP BY t.module_id GROUP BY t.module_id
</select> </select>
<select id="selectIdByConditions" <select id="selectIdByConditions"

View File

@ -3,7 +3,6 @@ package io.metersphere.plan.service;
import com.github.pagehelper.Page; import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import io.metersphere.plan.constants.TestPlanResourceConfig; import io.metersphere.plan.constants.TestPlanResourceConfig;
import io.metersphere.plan.dto.TestPlanQueryConditions;
import io.metersphere.plan.dto.request.TestPlanTableRequest; import io.metersphere.plan.dto.request.TestPlanTableRequest;
import io.metersphere.plan.dto.response.TestPlanResponse; import io.metersphere.plan.dto.response.TestPlanResponse;
import io.metersphere.plan.mapper.ExtTestPlanMapper; import io.metersphere.plan.mapper.ExtTestPlanMapper;
@ -43,8 +42,8 @@ public class TestPlanManagementService {
public Map<String, Long> moduleCount(TestPlanTableRequest request) { public Map<String, Long> moduleCount(TestPlanTableRequest request) {
//查出每个模块节点下的资源数量 不需要按照模块进行筛选 //查出每个模块节点下的资源数量 不需要按照模块进行筛选
TestPlanQueryConditions testPlanQueryConditions = new TestPlanQueryConditions(null, request.getProjectId(), request); request.setModuleIds(null);
List<ModuleCountDTO> moduleCountDTOList = extTestPlanMapper.countModuleIdByConditions(testPlanQueryConditions); List<ModuleCountDTO> moduleCountDTOList = extTestPlanMapper.countModuleIdByConditions(request);
Map<String, Long> moduleCountMap = testPlanModuleService.getModuleCountMap(request.getProjectId(), moduleCountDTOList); Map<String, Long> moduleCountMap = testPlanModuleService.getModuleCountMap(request.getProjectId(), moduleCountDTOList);
long allCount = 0; long allCount = 0;
for (ModuleCountDTO item : moduleCountDTOList) { for (ModuleCountDTO item : moduleCountDTOList) {