refactor(测试计划): 增加测试集脑图关联用例参数

This commit is contained in:
guoyuqi 2024-09-29 18:52:11 +08:00 committed by Yuki Guo
parent e48c01a8aa
commit a498986752
5 changed files with 21 additions and 9 deletions

View File

@ -19,4 +19,7 @@ public class TestPlanCaseMinderRequest extends BasePlanCaseBatchRequest {
@Schema(description = "脑图选中的项目id集合")
private List<String> minderProjectIds;
@Schema(description = "脑图选中的测试集id集合")
private List<String> minderCollectionIds;
}

View File

@ -77,7 +77,7 @@ public interface ExtTestPlanFunctionalCaseMapper {
List<TestPlanResourceExecResultDTO> selectDistinctExecResultByTestPlanIds(@Param("testPlanIds") List<String> testPlanIds);
Collection<String> selectIdsByProjectIds(@Param("request") TestPlanCaseMinderRequest request);
Collection<String> selectIdsByProjectIdsOrCollectionIds(@Param("request") TestPlanCaseMinderRequest request);
List<FunctionalCaseModule> selectProjectByModuleIds(@Param("moduleIds") List<String> moduleIds);

View File

@ -672,7 +672,7 @@
</select>
<select id="selectIdsByProjectIds" resultType="java.lang.String">
<select id="selectIdsByProjectIdsOrCollectionIds" resultType="java.lang.String">
SELECT
test_plan_functional_case.id
FROM
@ -682,10 +682,18 @@
test_plan_functional_case.test_plan_id = #{request.testPlanId}
AND functional_case.deleted = false
<include refid="queryWhereConditionByBatchQueryRequest"/>
and functional_case.project_id in
<foreach collection="request.getMinderProjectIds()" item="projectId" open="(" separator="," close=")">
#{projectId}
</foreach>
<if test="request.getMinderProjectIds() != null and request.getMinderProjectIds().size() > 0">
and functional_case.project_id in
<foreach collection="request.getMinderProjectIds()" item="projectId" open="(" separator="," close=")">
#{projectId}
</foreach>
</if>
<if test="request.getMinderCollectionIds() != null and request.getMinderCollectionIds().size() > 0">
and test_plan_functional_case.test_plan_collection_id IN
<foreach collection="request.getMinderCollectionIds()" item="collectionId" separator="," open="(" close=")">
#{collectionId}
</foreach>
</if>
</select>
<select id="selectProjectByModuleIds" resultType="io.metersphere.functional.domain.FunctionalCaseModule">

View File

@ -56,9 +56,9 @@ public class TestPlanFunctionalCaseMinderService {
return ids;
} else {
List<String> ids = new ArrayList<>();
//项目
if (CollectionUtils.isNotEmpty(request.getMinderProjectIds())) {
ids.addAll(extTestPlanFunctionalCaseMapper.selectIdsByProjectIds(request));
//项目 测试集
if (CollectionUtils.isNotEmpty(request.getMinderProjectIds()) || CollectionUtils.isNotEmpty(request.getMinderCollectionIds())) {
ids.addAll(extTestPlanFunctionalCaseMapper.selectIdsByProjectIdsOrCollectionIds(request));
}
//模块
if (CollectionUtils.isNotEmpty(request.getMinderModuleIds())) {

View File

@ -529,6 +529,7 @@ public class TestPlanCaseControllerTests extends BaseTest {
request.setMinderProjectIds(List.of("123"));
request.setMinderModuleIds(List.of("t_1"));
request.setMinderCaseIds(List.of("fc_1"));
request.setMinderCollectionIds(List.of("123"));
paramMap = new LinkedMultiValueMap<>();
paramMap.add("request", JSON.toJSONString(request));
paramMap.add("files", files);