refactor(测试计划): 优化计划详情用例列表分页查询

This commit is contained in:
song-cc-rock 2024-09-05 14:50:13 +08:00 committed by Craftsman
parent dd6a088a92
commit 40b46536ea
4 changed files with 6 additions and 6 deletions

View File

@ -74,7 +74,7 @@ public class TestPlanApiCaseController {
public Pager<List<TestPlanApiCasePageResponse>> page(@Validated @RequestBody TestPlanApiCaseRequest request) {
Page<Object> page = PageHelper.startPage(request.getCurrent(), request.getPageSize(),
StringUtils.isNotBlank(request.getSortString("id")) ? request.getSortString("id") : "t.pos desc");
return PageUtils.setPageInfo(page, testPlanApiCaseService.hasRelateApiCaseList(request, false));
return PageUtils.setPageInfo(page, testPlanApiCaseService.hasRelateApiCaseList(request, false, SessionUtils.getCurrentProjectId()));
}

View File

@ -63,7 +63,7 @@ public class TestPlanApiScenarioController {
public Pager<List<TestPlanApiScenarioPageResponse>> page(@Validated @RequestBody TestPlanApiScenarioRequest request) {
Page<Object> page = PageHelper.startPage(request.getCurrent(), request.getPageSize(),
StringUtils.isNotBlank(request.getSortString("id")) ? request.getSortString("id") : "test_plan_api_scenario.pos desc");
return PageUtils.setPageInfo(page, testPlanApiScenarioService.hasRelateApiScenarioList(request, false));
return PageUtils.setPageInfo(page, testPlanApiScenarioService.hasRelateApiScenarioList(request, false, SessionUtils.getCurrentProjectId()));
}
@PostMapping("/module/count")

View File

@ -244,13 +244,13 @@ public class TestPlanApiCaseService extends TestPlanResourceService {
* @param deleted
* @return
*/
public List<TestPlanApiCasePageResponse> hasRelateApiCaseList(TestPlanApiCaseRequest request, boolean deleted) {
public List<TestPlanApiCasePageResponse> hasRelateApiCaseList(TestPlanApiCaseRequest request, boolean deleted, String currentProjectId) {
filterCaseRequest(request);
if (CollectionUtils.isEmpty(request.getProtocols())) {
return new ArrayList<>();
}
List<TestPlanApiCasePageResponse> list = extTestPlanApiCaseMapper.relateApiCaseList(request, deleted);
buildApiCaseResponse(list, request.getTestPlanId(), request.getProjectId());
buildApiCaseResponse(list, request.getTestPlanId(), currentProjectId);
return list;
}

View File

@ -386,10 +386,10 @@ public class TestPlanApiScenarioService extends TestPlanResourceService {
* @param deleted
* @return
*/
public List<TestPlanApiScenarioPageResponse> hasRelateApiScenarioList(TestPlanApiScenarioRequest request, boolean deleted) {
public List<TestPlanApiScenarioPageResponse> hasRelateApiScenarioList(TestPlanApiScenarioRequest request, boolean deleted, String currentProjectId) {
filterCaseRequest(request);
List<TestPlanApiScenarioPageResponse> list = extTestPlanApiScenarioMapper.relateApiScenarioList(request, deleted);
buildApiScenarioResponse(list, request.getTestPlanId(), request.getProjectId());
buildApiScenarioResponse(list, request.getTestPlanId(), currentProjectId);
return list;
}