From cb3bcb38bdf99318f02a59e1db8b730981d2e039 Mon Sep 17 00:00:00 2001 From: song-cc-rock Date: Mon, 16 Dec 2024 17:43:11 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=B5=8B=E8=AF=95=E8=AE=A1=E5=88=92):=20?= =?UTF-8?q?=E5=88=86=E4=BA=AB=E7=9A=84=E6=8A=A5=E5=91=8A=E5=BC=80=E5=90=AF?= =?UTF-8?q?=E6=B5=8B=E8=AF=95=E7=82=B9=E5=90=8E=E6=98=8E=E7=BB=86=E5=88=97?= =?UTF-8?q?=E8=A1=A8=E9=A1=BA=E5=BA=8F=E4=B8=8D=E4=B8=80=E8=87=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1050473 --user=宋昌昌 【测试计划】报告-分享的报告-开启了测试点-测试点顺序与报告处不一致 https://www.tapd.cn/55049933/s/1631499 --- .../TestPlanReportShareController.java | 30 ++++++++++++++++++- .../plan/mapper/ExtTestPlanMapper.xml | 2 +- 2 files changed, 30 insertions(+), 2 deletions(-) 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 8deaf22730..a6e244dce2 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 @@ -98,7 +98,11 @@ public class TestPlanReportShareController { ShareInfo shareInfo = testPlanReportShareService.checkResource(request.getShareId()); testPlanReportShareService.validateExpired(shareInfo); Page page = PageHelper.startPage(request.getCurrent(), request.getPageSize(), - StringUtils.isNotBlank(request.getSortString()) ? request.getSortString() : "tprb.bug_num, tprb.id desc"); + StringUtils.isNotBlank(request.getSortString()) ? request.getSortString() : "tprb.bug_num desc"); + if (!request.getStartPager()) { + page.close(); + page.setOrderBy("tprb.bug_num desc"); + } return PageUtils.setPageInfo(page, testPlanReportService.listReportDetailBugs(request)); } @@ -112,6 +116,13 @@ public class TestPlanReportShareController { sort = StringUtils.replace(sort, "request_time", "request_duration"); Page page = PageHelper.startPage(request.getCurrent(), request.getPageSize(), StringUtils.isNotBlank(sort) ? sort : "tprfc.pos desc"); + if (!request.getStartPager()) { + // 不分页仅排序 {测试集升序, 用例位次倒序} + page.setPageSize(0); + page.setPageSizeZero(true); + page.setOrderBy("tpc.pos, tpc.name, tprfc.pos desc"); + page.setOrderByOnly(true); + } return PageUtils.setPageInfo(page, testPlanReportService.listReportDetailCases(request, null, AssociateCaseType.FUNCTIONAL)); } @@ -125,6 +136,13 @@ public class TestPlanReportShareController { sort = StringUtils.replace(sort, "request_time", "request_duration"); Page page = PageHelper.startPage(request.getCurrent(), request.getPageSize(), StringUtils.isNotBlank(sort) ? sort : "tprac.pos desc"); + if (!request.getStartPager()) { + // 不分页仅排序 {测试集升序, 用例位次倒序} + page.setPageSize(0); + page.setPageSizeZero(true); + page.setOrderBy("tpc.pos, tpc.name, tprac.pos desc"); + page.setOrderByOnly(true); + } return PageUtils.setPageInfo(page, testPlanReportService.listReportDetailCases(request, null, AssociateCaseType.API_CASE)); } @@ -138,6 +156,13 @@ public class TestPlanReportShareController { sort = StringUtils.replace(sort, "request_time", "request_duration"); Page page = PageHelper.startPage(request.getCurrent(), request.getPageSize(), StringUtils.isNotBlank(sort) ? sort : "tpras.pos desc"); + if (!request.getStartPager()) { + // 不分页仅排序 {测试集升序, 用例位次倒序} + page.setPageSize(0); + page.setPageSizeZero(true); + page.setOrderBy("tpc.pos, tpc.name, tpras.pos desc"); + page.setOrderByOnly(true); + } return PageUtils.setPageInfo(page, testPlanReportService.listReportDetailCases(request, null, AssociateCaseType.API_SCENARIO)); } @@ -148,6 +173,9 @@ public class TestPlanReportShareController { testPlanReportShareService.validateExpired(shareInfo); Page page = PageHelper.startPage(request.getCurrent(), request.getPageSize(), StringUtils.isNotBlank(request.getSortString()) ? request.getSortString() : "tpr.create_time desc"); + if (!request.getStartPager()) { + page.close(); + } return PageUtils.setPageInfo(page, testPlanReportService.planReportList(request)); } diff --git a/backend/services/test-plan/src/main/java/io/metersphere/plan/mapper/ExtTestPlanMapper.xml b/backend/services/test-plan/src/main/java/io/metersphere/plan/mapper/ExtTestPlanMapper.xml index ed1a5175cd..bd9cdf7955 100644 --- a/backend/services/test-plan/src/main/java/io/metersphere/plan/mapper/ExtTestPlanMapper.xml +++ b/backend/services/test-plan/src/main/java/io/metersphere/plan/mapper/ExtTestPlanMapper.xml @@ -113,7 +113,7 @@ - + and t.type = 'TEST_PLAN' and t.create_user = #{request.myTodoUserId}