From d5587f023ee73bb1c8290da1c83fe553d59e21e8 Mon Sep 17 00:00:00 2001 From: guoyuqi Date: Wed, 19 Jun 2024 19:08:19 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E5=8A=9F=E8=83=BD=E7=94=A8=E4=BE=8B):=20?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=94=A8=E4=BE=8B=E8=84=91=E5=9B=BE=E6=9B=B4?= =?UTF-8?q?=E6=96=B0=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/FunctionalCaseMinderService.java | 2 +- .../FunctionalCaseMinderControllerTest.java | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) 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);