feat(测试计划): 测试计划组报告总结一键生成内容新增子计划信息

--task=1016926 --user=王旭 【Bug转需求】[测试计划]github#33641生成报告统计的缺陷个数错误,应该用缺陷条数,而不是用关联用例加和-后端 https://www.tapd.cn/55049933/s/1603574
This commit is contained in:
WangXu10 2024-11-01 15:13:21 +08:00 committed by Craftsman
parent 6313afe427
commit fcee7fb217
6 changed files with 1382 additions and 1336 deletions

View File

@ -1,11 +1,14 @@
package io.metersphere.plan.dto.response;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import io.metersphere.plan.dto.CaseCount;
import io.metersphere.system.serializer.CustomRateSerializer;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.util.List;
@Data
public class TestPlanReportDetailResponse {
@ -91,4 +94,8 @@ public class TestPlanReportDetailResponse {
*/
@Schema(description = "报告是否默认布局")
private Boolean defaultLayout;
@JsonInclude(JsonInclude.Include.NON_EMPTY)
@Schema(description = "计划组子计划数据信息")
private List<TestPlanReportDetailResponse> children;
}

View File

@ -33,14 +33,30 @@
</select>
<select id="countBug" resultType="io.metersphere.plan.dto.ReportBugSumDTO">
select 'FUNCTIONAL' as caseType, ifnull(sum(tprfc.function_case_bug_count), 0) as bugCount from test_plan_report_function_case tprfc
where tprfc.test_plan_report_id = #{id}
union
select 'API' as caseType, ifnull(sum(tprac.api_case_bug_count), 0) as bugCount from test_plan_report_api_case tprac
where tprac.test_plan_report_id = #{id}
union
select 'SCENARIO' as caseType, ifnull(sum(tpras.api_scenario_bug_count), 0) as bugCount from test_plan_report_api_scenario tpras
where tpras.test_plan_report_id = #{id}
SELECT
'FUNCTIONAL' AS caseType,
count( DISTINCT brc.bug_id ) AS bugCount
FROM
bug_relation_case brc
INNER JOIN test_plan_report_function_case tprfc ON brc.test_plan_case_id = tprfc.test_plan_function_case_id
WHERE
tprfc.test_plan_report_id = #{id} UNION
SELECT
'API' AS caseType,
count( DISTINCT brc.bug_id ) AS bugCount
FROM
bug_relation_case brc
INNER JOIN test_plan_report_api_case tprac ON brc.test_plan_case_id = tprac.test_plan_api_case_id
WHERE
tprac.test_plan_report_id = #{id} UNION
SELECT
'SCENARIO' AS caseType,
count( DISTINCT brc.bug_id ) AS bugCount
FROM
bug_relation_case brc
INNER JOIN test_plan_report_api_scenario tpras ON brc.test_plan_case_id = tpras.test_plan_api_scenario_id
WHERE
tpras.test_plan_report_id = #{id}
</select>
<select id="countPlanBug" resultType="io.metersphere.plan.dto.ReportBugCountDTO">

View File

@ -67,4 +67,6 @@ public interface ExtTestPlanReportMapper {
List<ReportDTO> getReportsByIds(@Param("ids") List<String> ids);
void deleteGroupReport(@Param("id") String id);
List<TestPlanReport> getChildrenReport(@Param("reportId") String reportId);
}

View File

@ -137,7 +137,7 @@
tpr.result_status,
tpr.pass_rate,
tpr.pass_threshold,
(tprs.functional_case_count + tprs.api_case_count + tprs.api_scenario_count + tprs.bug_count) as caseTotal,
(tprs.functional_case_count + tprs.api_case_count + tprs.api_scenario_count) as caseTotal,
tpr.create_time,
tpr.deleted
@ -471,4 +471,9 @@
</when>
</choose>
</sql>
<select id="getChildrenReport" resultType="io.metersphere.plan.domain.TestPlanReport">
select id from test_plan_report where parent_id = #{reportId} and id != #{reportId}
</select>
</mapper>

View File

@ -296,6 +296,7 @@ public class TestPlanReportControllerTests extends BaseTest {
@Order(14)
void testGetReportSuccess() throws Exception {
this.requestGet(GET_PLAN_REPORT + "/" + GEN_REPORT_ID);
this.requestGet(GET_PLAN_REPORT + "/" + "test-plan-report-id-5");
}
@Test