refactor(测试计划): 缺陷列表补充项目ID字段

This commit is contained in:
song-cc-rock 2024-09-19 16:27:19 +08:00 committed by Craftsman
parent aadf25fd6f
commit 1dc14534e6
5 changed files with 13 additions and 8 deletions

View File

@ -18,4 +18,6 @@ public class TestPlanBugCaseDTO {
private String bugId; private String bugId;
@Schema(description = "用例名称") @Schema(description = "用例名称")
private String name; private String name;
@Schema(description = "项目ID")
private String projectId;
} }

View File

@ -42,7 +42,7 @@
<select id="getBugRelatedCase" resultType="io.metersphere.plan.dto.TestPlanBugCaseDTO"> <select id="getBugRelatedCase" resultType="io.metersphere.plan.dto.TestPlanBugCaseDTO">
select brc.case_id as id, fc.num as num, 'FUNCTIONAL' as type, brc.bug_id as bugId, fc.name as name select brc.case_id as id, fc.num as num, 'FUNCTIONAL' as type, brc.bug_id as bugId, fc.name as name, fc.project_id as projectId
from bug_relation_case brc from bug_relation_case brc
join functional_case fc on brc.case_id = fc.id join functional_case fc on brc.case_id = fc.id
where brc.test_plan_id = #{planId} where brc.test_plan_id = #{planId}
@ -51,7 +51,7 @@
#{id} #{id}
</foreach> </foreach>
union all union all
select brc.case_id as id, atc.num as num, 'API' as type, brc.bug_id as bugId, atc.name as name select brc.case_id as id, atc.num as num, 'API' as type, brc.bug_id as bugId, atc.name as name, atc.project_id as projectId
from bug_relation_case brc from bug_relation_case brc
join api_test_case atc on brc.case_id = atc.id join api_test_case atc on brc.case_id = atc.id
where brc.test_plan_id = #{planId} where brc.test_plan_id = #{planId}
@ -60,7 +60,7 @@
#{id} #{id}
</foreach> </foreach>
union all union all
select brc.case_id as id, asi.num as num, 'SCENARIO' as type, brc.bug_id as bugId, asi.name as name select brc.case_id as id, asi.num as num, 'SCENARIO' as type, brc.bug_id as bugId, asi.name as name, asi.project_id as projectId
from bug_relation_case brc from bug_relation_case brc
join api_scenario asi on brc.case_id = asi.id join api_scenario asi on brc.case_id = asi.id
where brc.test_plan_id = #{planId} where brc.test_plan_id = #{planId}

View File

@ -10,7 +10,7 @@
<select id="getPlanExecuteCases" resultType="io.metersphere.plan.domain.TestPlanReportApiCase"> <select id="getPlanExecuteCases" resultType="io.metersphere.plan.domain.TestPlanReportApiCase">
select tpac.id as testPlanApiCaseId, atc.id as apiCaseId, atc.num as apiCaseNum, atc.name as apiCaseName, atc.priority as apiCasePriority, select tpac.id as testPlanApiCaseId, atc.id as apiCaseId, atc.num as apiCaseNum, atc.name as apiCaseName, atc.priority as apiCasePriority,
tpac.test_plan_collection_id testPlanCollectionId, tpac.environment_id as environmentId, tpac.test_plan_collection_id testPlanCollectionId, tpac.environment_id as environmentId,
if(ad.module_id = 'root','未规划用例', ad.module_id) as apiCaseModule, tpac.execute_user as apiCaseExecuteUser, if(ad.module_id = 'root','未规划接口', ad.module_id) as apiCaseModule, tpac.execute_user as apiCaseExecuteUser,
ifnull(tpac.last_exec_result, 'PENDING') as apiCaseExecuteResult, tpac.last_exec_report_id apiCaseExecuteReportId, tpac.pos as pos ifnull(tpac.last_exec_result, 'PENDING') as apiCaseExecuteResult, tpac.last_exec_report_id apiCaseExecuteReportId, tpac.pos as pos
from test_plan_api_case tpac join api_test_case atc on atc.id = tpac.api_case_id from test_plan_api_case tpac join api_test_case atc on atc.id = tpac.api_case_id
left join api_definition ad on atc.api_definition_id = ad.id left join api_definition ad on atc.api_definition_id = ad.id
@ -40,7 +40,8 @@
where tprac.test_plan_report_id = #{request.reportId} where tprac.test_plan_report_id = #{request.reportId}
<if test="request.keyword != null and request.keyword != ''"> <if test="request.keyword != null and request.keyword != ''">
and (tprac.api_case_num like concat('%', #{request.keyword}, '%') and (tprac.api_case_num like concat('%', #{request.keyword}, '%')
or tprac.api_case_name like concat('%', #{request.keyword}, '%')) or tprac.api_case_name like concat('%', #{request.keyword}, '%')
or tprac.api_case_module like concat('%', #{request.keyword}, '%'))
</if> </if>
<if test="request.collectionId != null and request.collectionId != ''"> <if test="request.collectionId != null and request.collectionId != ''">
and tprac.test_plan_collection_id = #{request.collectionId} and tprac.test_plan_collection_id = #{request.collectionId}

View File

@ -10,7 +10,7 @@
<select id="getPlanExecuteCases" resultType="io.metersphere.plan.domain.TestPlanReportApiScenario"> <select id="getPlanExecuteCases" resultType="io.metersphere.plan.domain.TestPlanReportApiScenario">
select tpas.id as testPlanApiScenarioId, aso.id as apiScenarioId, aso.num as apiScenarioNum, aso.name as apiScenarioName, aso.priority as apiScenarioPriority, select tpas.id as testPlanApiScenarioId, aso.id as apiScenarioId, aso.num as apiScenarioNum, aso.name as apiScenarioName, aso.priority as apiScenarioPriority,
tpas.test_plan_collection_id testPlanCollectionId, tpas.grouped as grouped, tpas.environment_id environmentId, tpas.test_plan_collection_id testPlanCollectionId, tpas.grouped as grouped, tpas.environment_id environmentId,
if(aso.module_id = 'root','未规划用例', aso.module_id) as apiScenarioModule, tpas.execute_user as apiScenarioExecuteUser, if(aso.module_id = 'root','未规划场景', aso.module_id) as apiScenarioModule, tpas.execute_user as apiScenarioExecuteUser,
ifnull(tpas.last_exec_result, 'PENDING') as apiScenarioExecuteResult, tpas.last_exec_report_id apiScenarioExecuteReportId, tpas.pos as pos ifnull(tpas.last_exec_result, 'PENDING') as apiScenarioExecuteResult, tpas.last_exec_report_id apiScenarioExecuteReportId, tpas.pos as pos
from test_plan_api_scenario tpas join api_scenario aso on aso.id = tpas.api_scenario_id from test_plan_api_scenario tpas join api_scenario aso on aso.id = tpas.api_scenario_id
left join api_scenario_module asm on aso.module_id = asm.id left join api_scenario_module asm on aso.module_id = asm.id
@ -39,7 +39,8 @@
where tpras.test_plan_report_id = #{request.reportId} where tpras.test_plan_report_id = #{request.reportId}
<if test="request.keyword != null and request.keyword != ''"> <if test="request.keyword != null and request.keyword != ''">
and (tpras.api_scenario_num like concat('%', #{request.keyword}, '%') and (tpras.api_scenario_num like concat('%', #{request.keyword}, '%')
or tpras.api_scenario_name like concat('%', #{request.keyword}, '%')) or tpras.api_scenario_name like concat('%', #{request.keyword}, '%')
or tpras.api_scenario_module like concat('%', #{request.keyword}, '%'))
</if> </if>
<if test="request.collectionId != null and request.collectionId != ''"> <if test="request.collectionId != null and request.collectionId != ''">
and tpras.test_plan_collection_id = #{request.collectionId} and tpras.test_plan_collection_id = #{request.collectionId}

View File

@ -60,7 +60,8 @@
where tprfc.test_plan_report_id = #{request.reportId} where tprfc.test_plan_report_id = #{request.reportId}
<if test="request.keyword != null and request.keyword != ''"> <if test="request.keyword != null and request.keyword != ''">
and (tprfc.function_case_num like concat('%', #{request.keyword}, '%') and (tprfc.function_case_num like concat('%', #{request.keyword}, '%')
or tprfc.function_case_name like concat('%', #{request.keyword}, '%')) or tprfc.function_case_name like concat('%', #{request.keyword}, '%')
or tprfc.function_case_module like concat('%', #{request.keyword}, '%'))
</if> </if>
<if test="request.collectionId != null and request.collectionId != ''"> <if test="request.collectionId != null and request.collectionId != ''">
and tprfc.test_plan_collection_id = #{request.collectionId} and tprfc.test_plan_collection_id = #{request.collectionId}