fix(测试计划): 计划组报告的缺陷明细未分组去重

--bug=1049478 --user=宋昌昌 【测试计划】计划组-执行计划组-计划组内两个子计划关联了同一个缺陷-查看计划组报告-缺陷明细显示了两个缺陷 https://www.tapd.cn/55049933/s/1617111
This commit is contained in:
song-cc-rock 2024-11-25 19:18:38 +08:00 committed by Craftsman
parent 7f366dd9db
commit 5ffda82781
2 changed files with 4 additions and 3 deletions

View File

@ -173,10 +173,10 @@ public class TestPlanReportController {
public Pager<List<BugDTO>> pageBug(@Validated @RequestBody TestPlanReportDetailPageRequest request) { public Pager<List<BugDTO>> pageBug(@Validated @RequestBody TestPlanReportDetailPageRequest request) {
request.setDetailReportIds(testPlanReportService.getActualReportIds(request.getReportId())); request.setDetailReportIds(testPlanReportService.getActualReportIds(request.getReportId()));
Page<Object> page = PageHelper.startPage(request.getCurrent(), request.getPageSize(), Page<Object> page = PageHelper.startPage(request.getCurrent(), request.getPageSize(),
StringUtils.isNotBlank(request.getSortString()) ? request.getSortString() : "tprb.bug_num, tprb.id desc"); StringUtils.isNotBlank(request.getSortString()) ? request.getSortString() : "tprb.bug_num desc");
if (!request.getStartPager()) { if (!request.getStartPager()) {
page.close(); page.close();
page.setOrderBy("tprb.bug_num, tprb.id desc"); page.setOrderBy("tprb.bug_num desc");
} }
return PageUtils.setPageInfo(page, testPlanReportService.listReportDetailBugs(request)); return PageUtils.setPageInfo(page, testPlanReportService.listReportDetailBugs(request));
} }

View File

@ -24,7 +24,7 @@
<select id="list" resultType="io.metersphere.bug.dto.response.BugDTO"> <select id="list" resultType="io.metersphere.bug.dto.response.BugDTO">
select distinct tprb.bug_id as id, tprb.bug_num as num, tprb.bug_title as title, tprb.bug_status as status, tprb.bug_status as statusName, 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_status as statusName, tprb.bug_handle_user as handleUserName,
ifnull(tprb.bug_case_count, 0) as relationCaseCount sum(ifnull(tprb.bug_case_count, 0)) as relationCaseCount
from test_plan_report_bug tprb from test_plan_report_bug tprb
where tprb.test_plan_report_id in where tprb.test_plan_report_id in
<foreach collection="request.detailReportIds" item="id" open="(" close=")" separator=","> <foreach collection="request.detailReportIds" item="id" open="(" close=")" separator=",">
@ -33,6 +33,7 @@
<if test="request.keyword != null and request.keyword != ''"> <if test="request.keyword != null and request.keyword != ''">
and (tprb.bug_num like concat('%', #{request.keyword}, '%') or tprb.bug_title like concat('%', #{request.keyword}, '%')) and (tprb.bug_num like concat('%', #{request.keyword}, '%') or tprb.bug_title like concat('%', #{request.keyword}, '%'))
</if> </if>
group by tprb.bug_id, tprb.bug_num
</select> </select>
<select id="countBug" resultType="io.metersphere.plan.dto.ReportBugSumDTO"> <select id="countBug" resultType="io.metersphere.plan.dto.ReportBugSumDTO">