From 45124ddd5e954e916cea12600468d9d1e55a49f2 Mon Sep 17 00:00:00 2001 From: song-cc-rock Date: Tue, 25 Jun 2024 18:11:26 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=B5=8B=E8=AF=95=E8=AE=A1=E5=88=92):=20?= =?UTF-8?q?=E6=8A=A5=E5=91=8A=E6=98=8E=E7=BB=86=E9=BB=98=E8=AE=A4=E6=8E=92?= =?UTF-8?q?=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../plan/controller/TestPlanReportController.java | 9 ++++++--- .../plan/controller/TestPlanReportShareController.java | 9 ++++++--- 2 files changed, 12 insertions(+), 6 deletions(-) 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)); }