fix(测试计划): 模块树节点删除计划未被删除&&报告详情缺陷列表去重展示

This commit is contained in:
song-cc-rock 2024-05-22 11:17:43 +08:00 committed by 刘瑞斌
parent 73e173310c
commit d5a87f5f04
5 changed files with 22 additions and 8 deletions

View File

@ -235,9 +235,10 @@
<select id="countModuleIdByConditions"
parameterType="io.metersphere.plan.dto.TestPlanQueryConditions"
resultType="io.metersphere.project.dto.ModuleCountDTO">
SELECT t.module_id AS moduleId, count(t.id) AS dataCount
SELECT t.module_id AS moduleId, count(distinct t.id) AS dataCount
FROM test_plan t
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')
<include refid="test_plan_page_request"/>
GROUP BY t.module_id
</select>

View File

@ -16,6 +16,8 @@ public interface ExtTestPlanModuleMapper {
List<String> selectChildrenIdsByParentIds(@Param("ids") List<String> strings);
List<String> selectPlanIdsByModuleIds(@Param("ids") List<String> strings);
void deleteByIds(@Param("ids") List<String> deleteId);
BaseModule selectBaseModuleById(String dragNodeId);

View File

@ -29,6 +29,14 @@
#{id}
</foreach>
</select>
<select id="selectPlanIdsByModuleIds" resultType="java.lang.String">
SELECT id FROM test_plan WHERE module_id IN
<foreach collection="ids" item="id" open="(" separator="," close=")">
#{id}
</foreach>
</select>
<select id="selectBaseModuleById" resultType="io.metersphere.system.dto.sdk.BaseModule">
SELECT id, name, pos, project_Id, parent_id
FROM test_plan_module

View File

@ -11,7 +11,7 @@
</select>
<select id="list" resultType="io.metersphere.bug.dto.response.BugDTO">
select tprb.bug_id as id, tprb.bug_num as num, tprb.bug_title as title, tprb.bug_status as status, tprb.bug_handle_user as handleUserName,
select distinct tprb.bug_id as id, tprb.bug_num as num, tprb.bug_title as title, tprb.bug_status as status, tprb.bug_handle_user as handleUserName,
tprb.bug_case_count as relationCaseCount
from test_plan_report_bug tprb
where tprb.test_plan_report_id = #{request.reportId}

View File

@ -141,12 +141,15 @@ public class TestPlanModuleService extends ModuleTreeService {
return;
}
extTestPlanModuleMapper.deleteByIds(deleteIds);
TestPlanBatchProcessRequest request = new TestPlanBatchProcessRequest();
request.setModuleIds(deleteIds);
request.setSelectAll(true);
request.setProjectId(projectId);
testPlanService.batchDelete(request, operator, requestUrl, requestMethod);
List<String> planDeleteIds = extTestPlanModuleMapper.selectPlanIdsByModuleIds(deleteIds);
if (CollectionUtils.isNotEmpty(planDeleteIds)) {
TestPlanBatchProcessRequest request = new TestPlanBatchProcessRequest();
request.setModuleIds(deleteIds);
request.setSelectAll(false);
request.setProjectId(projectId);
request.setSelectIds(planDeleteIds);
testPlanService.batchDelete(request, operator, requestUrl, requestMethod);
}
List<String> childrenIds = extTestPlanModuleMapper.selectChildrenIdsByParentIds(deleteIds);
if (CollectionUtils.isNotEmpty(childrenIds)) {