fix(测试计划): 报告测试点列表排序有误

--bug=1046956 --user=宋昌昌 【测试计划】报告-报告详情-用例/接口/场景明细-开启测试点-顺序显示与测试规划内不一致 https://www.tapd.cn/55049933/s/1606900
This commit is contained in:
song-cc-rock 2024-11-06 18:32:39 +08:00 committed by Craftsman
parent 18164669c9
commit 1a38c3a1f0
2 changed files with 7 additions and 8 deletions

View File

@ -39,6 +39,9 @@ import org.springframework.web.multipart.MultipartFile;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
/**
* @author song-cc-rock
*/
@RestController @RestController
@RequestMapping("/test-plan/report") @RequestMapping("/test-plan/report")
@Tag(name = "测试计划-报告") @Tag(name = "测试计划-报告")
@ -254,10 +257,8 @@ public class TestPlanReportController {
@CheckOwner(resourceId = "#request.getReportId()", resourceType = "test_plan_report") @CheckOwner(resourceId = "#request.getReportId()", resourceType = "test_plan_report")
@Parameter(name = "type", description = "用例类型", schema = @Schema(requiredMode = Schema.RequiredMode.REQUIRED), example = "functional, api, scenario") @Parameter(name = "type", description = "用例类型", schema = @Schema(requiredMode = Schema.RequiredMode.REQUIRED), example = "functional, api, scenario")
public Pager<List<TestPlanReportDetailCollectionResponse>> collectionPage(@PathVariable String type, @Validated @RequestBody TestPlanReportDetailPageRequest request) { public Pager<List<TestPlanReportDetailCollectionResponse>> collectionPage(@PathVariable String type, @Validated @RequestBody TestPlanReportDetailPageRequest request) {
Page<Object> page = PageHelper.startPage(request.getCurrent(), request.getPageSize()); // 默认按照测试集的位序升序
if (!request.getStartPager()) { Page<Object> page = PageHelper.startPage(request.getCurrent(), request.getPageSize(), "tpc.pos asc");
page.close();
}
return PageUtils.setPageInfo(page, testPlanReportService.listReportCollection(request, type)); return PageUtils.setPageInfo(page, testPlanReportService.listReportCollection(request, type));
} }
} }

View File

@ -1298,11 +1298,9 @@ public class TestPlanReportService {
public List<TestPlanReportDetailCollectionResponse> listReportCollection(TestPlanReportDetailPageRequest request, String caseType) { public List<TestPlanReportDetailCollectionResponse> listReportCollection(TestPlanReportDetailPageRequest request, String caseType) {
List<TestPlanReportDetailCollectionResponse> collections; List<TestPlanReportDetailCollectionResponse> collections;
switch (caseType) { switch (caseType) {
case CollectionQueryType.FUNCTIONAL -> case CollectionQueryType.FUNCTIONAL -> collections = extTestPlanReportFunctionalCaseMapper.listCollection(request);
collections = extTestPlanReportFunctionalCaseMapper.listCollection(request);
case CollectionQueryType.API -> collections = extTestPlanReportApiCaseMapper.listCollection(request); case CollectionQueryType.API -> collections = extTestPlanReportApiCaseMapper.listCollection(request);
case CollectionQueryType.SCENARIO -> case CollectionQueryType.SCENARIO -> collections = extTestPlanReportApiScenarioMapper.listCollection(request);
collections = extTestPlanReportApiScenarioMapper.listCollection(request);
default -> collections = new ArrayList<>(); default -> collections = new ArrayList<>();
} }
collections.sort(Comparator.comparing(TestPlanReportDetailCollectionResponse::getPos)); collections.sort(Comparator.comparing(TestPlanReportDetailCollectionResponse::getPos));