refactor(测试计划): 优化接口列表返回值&查询sql

This commit is contained in:
WangXu10 2024-06-17 11:12:42 +08:00 committed by Craftsman
parent 12cda645a4
commit d083774987
5 changed files with 9 additions and 3 deletions

View File

@ -67,4 +67,7 @@ public class TestPlanApiScenarioPageResponse implements Serializable {
@Schema(description = "状态")
private String status;
@Schema(description = "场景用例的id")
private String apiScenarioId;
}

View File

@ -69,7 +69,7 @@ public interface ExtTestPlanApiCaseMapper {
List<TestPlanApiCase> getApiCaseExecuteInfoByIds(@Param("ids") List<String> ids);
List<ApiTestCase> selectApiCaseByDefinitionIds(@Param("ids") List<String> ids, @Param("isRepeat") boolean isRepeat);
List<ApiTestCase> selectApiCaseByDefinitionIds(@Param("ids") List<String> ids, @Param("isRepeat") boolean isRepeat, @Param("testPlanId") String testPlanId);
List<TestPlanApiCase> getSelectIdAndCollectionId(@Param("request") TestPlanApiCaseBatchRequest request);
}

View File

@ -702,6 +702,7 @@
api_case_id
FROM
test_plan_api_case
where test_plan_api_case.test_plan_id = #{testPlanId}
)
</if>
</select>

View File

@ -93,6 +93,7 @@
api_scenario.project_id,
api_scenario.create_user,
api_scenario.status,
api_scenario.id as apiScenarioId,
test_plan_api_scenario.create_time,
test_plan_api_scenario.environment_id,
api_scenario.module_id,

View File

@ -551,7 +551,7 @@ public class TestPlanApiCaseService extends TestPlanResourceService {
if (CollectionUtils.isNotEmpty(apiCaseList)) {
List<String> ids = apiCaseList.stream().flatMap(item -> item.getIds().stream()).toList();
boolean isRepeat = testPlanConfigService.isRepeatCase(testPlan.getId());
List<ApiTestCase> apiTestCaseList = extTestPlanApiCaseMapper.selectApiCaseByDefinitionIds(ids, isRepeat);
List<ApiTestCase> apiTestCaseList = extTestPlanApiCaseMapper.selectApiCaseByDefinitionIds(ids, isRepeat, testPlan.getId());
apiCaseList.forEach(apiCase -> {
List<String> apiCaseIds = apiCase.getIds();
if (CollectionUtils.isNotEmpty(apiCaseIds)) {
@ -684,6 +684,7 @@ public class TestPlanApiCaseService extends TestPlanResourceService {
/**
* 预生成用例的执行报告
*
* @return
*/
public ApiTestCaseRecord initApiReport(ApiTestCase apiTestCase, TestPlanApiCase testPlanApiCase, String reportId, ApiRunModeConfigDTO runModeConfig, String userId) {