diff --git a/backend/services/test-plan/src/main/java/io/metersphere/plan/controller/TestPlanReportController.java b/backend/services/test-plan/src/main/java/io/metersphere/plan/controller/TestPlanReportController.java index 05a83c1b76..142343a059 100644 --- a/backend/services/test-plan/src/main/java/io/metersphere/plan/controller/TestPlanReportController.java +++ b/backend/services/test-plan/src/main/java/io/metersphere/plan/controller/TestPlanReportController.java @@ -136,7 +136,8 @@ public class TestPlanReportController { @RequiresPermissions(value = {PermissionConstants.TEST_PLAN_REPORT_READ, PermissionConstants.TEST_PLAN_READ_EXECUTE}, logical = Logical.OR) @CheckOwner(resourceId = "#request.getReportId()", resourceType = "test_plan_report") public Pager> pageFunctionalCase(@Validated @RequestBody TestPlanReportDetailPageRequest request) { - Page page = PageHelper.startPage(request.getCurrent(), request.getPageSize(), null); + Page page = PageHelper.startPage(request.getCurrent(), request.getPageSize(), + StringUtils.isNotBlank(request.getSortString()) ? request.getSortString() : "tprfc.pos desc"); return PageUtils.setPageInfo(page, testPlanReportService.listReportDetailCases(request, AssociateCaseType.FUNCTIONAL)); } @@ -145,7 +146,8 @@ public class TestPlanReportController { @RequiresPermissions(value = {PermissionConstants.TEST_PLAN_REPORT_READ, PermissionConstants.TEST_PLAN_READ_EXECUTE}, logical = Logical.OR) @CheckOwner(resourceId = "#request.getReportId()", resourceType = "test_plan_report") public Pager> pageApiCase(@Validated @RequestBody TestPlanReportDetailPageRequest request) { - Page page = PageHelper.startPage(request.getCurrent(), request.getPageSize(), null); + Page page = PageHelper.startPage(request.getCurrent(), request.getPageSize(), + StringUtils.isNotBlank(request.getSortString()) ? request.getSortString() : "tprac.pos desc"); return PageUtils.setPageInfo(page, testPlanReportService.listReportDetailCases(request, AssociateCaseType.API_CASE)); } @@ -154,7 +156,8 @@ public class TestPlanReportController { @RequiresPermissions(value = {PermissionConstants.TEST_PLAN_REPORT_READ, PermissionConstants.TEST_PLAN_READ_EXECUTE}, logical = Logical.OR) @CheckOwner(resourceId = "#request.getReportId()", resourceType = "test_plan_report") public Pager> pageScenarioCase(@Validated @RequestBody TestPlanReportDetailPageRequest request) { - Page page = PageHelper.startPage(request.getCurrent(), request.getPageSize(), null); + Page page = PageHelper.startPage(request.getCurrent(), request.getPageSize(), + StringUtils.isNotBlank(request.getSortString()) ? request.getSortString() : "tpras.pos desc"); return PageUtils.setPageInfo(page, testPlanReportService.listReportDetailCases(request, AssociateCaseType.API_SCENARIO)); } diff --git a/backend/services/test-plan/src/main/java/io/metersphere/plan/controller/TestPlanReportShareController.java b/backend/services/test-plan/src/main/java/io/metersphere/plan/controller/TestPlanReportShareController.java index 83e25061d4..60cf4b74d0 100644 --- a/backend/services/test-plan/src/main/java/io/metersphere/plan/controller/TestPlanReportShareController.java +++ b/backend/services/test-plan/src/main/java/io/metersphere/plan/controller/TestPlanReportShareController.java @@ -93,7 +93,8 @@ public class TestPlanReportShareController { public Pager> pageFunctionalCase(@Validated @RequestBody TestPlanShareReportDetailRequest request) { ShareInfo shareInfo = testPlanReportShareService.checkResource(request.getShareId()); testPlanReportShareService.validateExpired(shareInfo); - Page page = PageHelper.startPage(request.getCurrent(), request.getPageSize(), null); + Page page = PageHelper.startPage(request.getCurrent(), request.getPageSize(), + StringUtils.isNotBlank(request.getSortString()) ? request.getSortString() : "tprfc.pos desc"); return PageUtils.setPageInfo(page, testPlanReportService.listReportDetailCases(request, AssociateCaseType.FUNCTIONAL)); } @@ -102,7 +103,8 @@ public class TestPlanReportShareController { public Pager> pageApiCase(@Validated @RequestBody TestPlanShareReportDetailRequest request) { ShareInfo shareInfo = testPlanReportShareService.checkResource(request.getShareId()); testPlanReportShareService.validateExpired(shareInfo); - Page page = PageHelper.startPage(request.getCurrent(), request.getPageSize(), null); + Page page = PageHelper.startPage(request.getCurrent(), request.getPageSize(), + StringUtils.isNotBlank(request.getSortString()) ? request.getSortString() : "tprac.pos desc"); return PageUtils.setPageInfo(page, testPlanReportService.listReportDetailCases(request, AssociateCaseType.API_CASE)); } @@ -111,7 +113,8 @@ public class TestPlanReportShareController { public Pager> pageScenarioCase(@Validated @RequestBody TestPlanShareReportDetailRequest request) { ShareInfo shareInfo = testPlanReportShareService.checkResource(request.getShareId()); testPlanReportShareService.validateExpired(shareInfo); - Page page = PageHelper.startPage(request.getCurrent(), request.getPageSize(), null); + Page page = PageHelper.startPage(request.getCurrent(), request.getPageSize(), + StringUtils.isNotBlank(request.getSortString()) ? request.getSortString() : "tpras.pos desc"); return PageUtils.setPageInfo(page, testPlanReportService.listReportDetailCases(request, AssociateCaseType.API_SCENARIO)); }