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");