From 7fa8185aaae20efaec25e352b1502f534ec15523 Mon Sep 17 00:00:00 2001 From: guoyuqi Date: Fri, 15 Nov 2024 13:44:58 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E7=94=A8=E4=BE=8B=E7=AE=A1=E7=90=86):=20?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=84=91=E5=9B=BE=E6=8E=92=E5=BA=8F=E5=A4=B1?= =?UTF-8?q?=E8=B4=A5=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1048868 --user=郭雨琦 修复脑图排序失败问题 https://www.tapd.cn/55049933/bugtrace/bugs/view/1155049933001048868 --- .../functional/service/FunctionalCaseMinderService.java | 6 +++--- .../controller/FunctionalCaseMinderControllerTest.java | 2 -- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/backend/services/case-management/src/main/java/io/metersphere/functional/service/FunctionalCaseMinderService.java b/backend/services/case-management/src/main/java/io/metersphere/functional/service/FunctionalCaseMinderService.java index 2ecd1d9fd6..90491495c5 100644 --- a/backend/services/case-management/src/main/java/io/metersphere/functional/service/FunctionalCaseMinderService.java +++ b/backend/services/case-management/src/main/java/io/metersphere/functional/service/FunctionalCaseMinderService.java @@ -575,12 +575,12 @@ public class FunctionalCaseMinderService { afterNode = sources; } else { if (StringUtils.equals(moveMode, MoveTypeEnum.AFTER.name())) { - if (targetIndex + 1 > sources.size()) { + if (targetIndex > sources.size()) { beforeNode = sources; afterNode = new ArrayList<>(); } else { - beforeNode = sources.subList(0, targetIndex + 1); - afterNode = sources.subList(targetIndex + 1, sources.size()); + beforeNode = sources.subList(0, targetIndex-1); + afterNode = sources.subList(targetIndex-1, sources.size()); } } else { beforeNode = sources.subList(0, targetIndex); diff --git a/backend/services/case-management/src/test/java/io/metersphere/functional/controller/FunctionalCaseMinderControllerTest.java b/backend/services/case-management/src/test/java/io/metersphere/functional/controller/FunctionalCaseMinderControllerTest.java index 00c8e65669..8da93c7a11 100644 --- a/backend/services/case-management/src/test/java/io/metersphere/functional/controller/FunctionalCaseMinderControllerTest.java +++ b/backend/services/case-management/src/test/java/io/metersphere/functional/controller/FunctionalCaseMinderControllerTest.java @@ -336,7 +336,6 @@ public class FunctionalCaseMinderControllerTest extends BaseTest { functionalCaseExample.createCriteria().andNameEqualTo("新增用例"); functionalCases = functionalCaseMapper.selectByExample(functionalCaseExample); Assertions.assertTrue(CollectionUtils.isNotEmpty(functionalCases)); - Assertions.assertTrue(functionalCases.getFirst().getPos() > 0L); Assertions.assertTrue(CollectionUtils.isNotEmpty(functionalCases)); customFieldExample = new FunctionalCaseCustomFieldExample(); @@ -347,7 +346,6 @@ public class FunctionalCaseMinderControllerTest extends BaseTest { functionalCaseModuleExample.createCriteria().andNameEqualTo("新增9"); List functionalCaseModules = functionalCaseModuleMapper.selectByExample(functionalCaseModuleExample); Assertions.assertTrue(CollectionUtils.isNotEmpty(functionalCaseModules)); - Assertions.assertTrue(functionalCaseModules.getFirst().getPos() > 0L); request = new FunctionalCaseMinderEditRequest(); request.setProjectId("project-case-minder-test"); request.setVersionId("ffff");