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 168d0c665e..5adaf1dfd9 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 @@ -990,7 +990,7 @@ public class FunctionalCaseMinderService { functionalCase.setCreateTime(null); //更新用例 caseMapper.updateByPrimaryKeySelective(functionalCase); - return functionalCase; + return caseMapper.selectByPrimaryKey(functionalCase.getId()); } private FunctionalCaseBlob updateBlob(FunctionalCaseChangeRequest functionalCaseChangeRequest, String caseId, FunctionalCaseBlobMapper caseBlobMapper) { 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 a97ceaa3b5..48684dba09 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 @@ -177,6 +177,7 @@ public class FunctionalCaseMinderControllerTest extends BaseTest { customFields.add(customFieldDTO); caseChangeRequest.setCustomFields(customFields); caseChangeRequests.add(caseChangeRequest); + caseChangeRequest = new FunctionalCaseChangeRequest(); caseChangeRequest.setId("TEST_FUNCTIONAL_MINDER_CASE_ID_1"); caseChangeRequest.setName("TEST_MINDER_MODULE_ID_GYQ_更新"); @@ -196,6 +197,7 @@ public class FunctionalCaseMinderControllerTest extends BaseTest { caseChangeRequest.setCustomFields(customFields); caseChangeRequests.add(caseChangeRequest); request.setUpdateCaseList(caseChangeRequests); + List functionalCaseModuleEditRequests = new ArrayList<>(); FunctionalCaseModuleEditRequest functionalCaseModuleEditRequest = new FunctionalCaseModuleEditRequest(); functionalCaseModuleEditRequest.setId("uuuId"); @@ -214,6 +216,7 @@ public class FunctionalCaseMinderControllerTest extends BaseTest { functionalCaseModuleEditRequest.setParentId("TEST_MINDER_MODULE_ID_GYQ"); functionalCaseModuleEditRequests.add(functionalCaseModuleEditRequest); request.setUpdateModuleList(functionalCaseModuleEditRequests); + List additionalNodeList = new ArrayList<>(); MindAdditionalNodeRequest mindAdditionalNodeRequest = new MindAdditionalNodeRequest(); mindAdditionalNodeRequest.setId("weyyg"); @@ -228,6 +231,7 @@ public class FunctionalCaseMinderControllerTest extends BaseTest { mindAdditionalNodeRequest.setParentId("TEST_MINDER_MODULE_ID_GYQ"); additionalNodeList.add(mindAdditionalNodeRequest); request.setAdditionalNodeList(additionalNodeList); + List deleteResourceList = new ArrayList<>(); MinderOptionDTO minderOptionDTO = new MinderOptionDTO(); minderOptionDTO.setId("TEST_FUNCTIONAL_MINDER_CASE_ID_9"); @@ -243,6 +247,12 @@ public class FunctionalCaseMinderControllerTest extends BaseTest { deleteResourceList.add(minderOptionDTO); request.setDeleteResourceList(deleteResourceList); this.requestPostWithOkAndReturn(FUNCTIONAL_CASE_EDIT_URL, request); + + FunctionalCase functionalCase = functionalCaseMapper.selectByPrimaryKey("TEST_FUNCTIONAL_MINDER_CASE_ID_1"); + System.out.println(functionalCase); + + Assertions.assertTrue(StringUtils.equalsIgnoreCase(functionalCase.getName(),"TEST_MINDER_MODULE_ID_GYQ_更新")); + MindAdditionalNode mindAdditionalNode = mindAdditionalNodeMapper.selectByPrimaryKey("additional2"); Assertions.assertTrue(StringUtils.equalsIgnoreCase(mindAdditionalNode.getParentId(),"TEST_MINDER_MODULE_ID_GYQ")); FunctionalCaseExample functionalCaseExample = new FunctionalCaseExample(); @@ -250,6 +260,8 @@ public class FunctionalCaseMinderControllerTest extends BaseTest { List functionalCases = functionalCaseMapper.selectByExample(functionalCaseExample); Assertions.assertTrue(CollectionUtils.isNotEmpty(functionalCases)); Assertions.assertTrue(functionalCases.get(0).getPos() > 0L); + + Assertions.assertTrue(CollectionUtils.isNotEmpty(functionalCases)); FunctionalCaseCustomFieldExample customFieldExample = new FunctionalCaseCustomFieldExample(); customFieldExample.createCriteria().andCaseIdEqualTo(functionalCases.get(0).getId()).andFieldIdEqualTo("custom_field_minder_gyq_id_3"); List functionalCaseCustomFields = functionalCaseCustomFieldMapper.selectByExample(customFieldExample);