diff --git a/backend/src/main/java/io/metersphere/api/service/ApiTestCaseService.java b/backend/src/main/java/io/metersphere/api/service/ApiTestCaseService.java index ebc11fe7c9..fb7a3b3f4c 100644 --- a/backend/src/main/java/io/metersphere/api/service/ApiTestCaseService.java +++ b/backend/src/main/java/io/metersphere/api/service/ApiTestCaseService.java @@ -384,7 +384,7 @@ public class ApiTestCaseService { public void checkNameExist(SaveApiTestCaseRequest request) { if (hasSameCase(request)) { - MSException.throwException(Translator.get("load_test_already_exists")); + MSException.throwException(Translator.get("load_test_already_exists") + ": " + request.getName()); } } @@ -1020,7 +1020,19 @@ public class ApiTestCaseService { if (request.isSelectAll()) { ids = this.getAllApiCaseIdsByFontedSelect(request.getFilters(), request.getModuleIds(), request.getName(), request.getProjectId(), request.getProtocol(), request.getUnSelectIds(), request.getStatus(), null, request.getCombine()); } - + ApiTestCaseExample apiTestCaseExample = new ApiTestCaseExample(); + apiTestCaseExample.createCriteria().andIdIn(ids); + List apiCaseList = apiTestCaseMapper.selectByExample(apiTestCaseExample); + SaveApiTestCaseRequest saveApiTestCaseRequest = new SaveApiTestCaseRequest(); + if (CollectionUtils.isNotEmpty(apiCaseList)) { + for (ApiTestCase apiTestCaseDTO : apiCaseList) { + saveApiTestCaseRequest.setName(apiTestCaseDTO.getName()); + saveApiTestCaseRequest.setApiDefinitionId(apiTestCaseDTO.getApiDefinitionId()); + saveApiTestCaseRequest.setId(apiTestCaseDTO.getId()); + saveApiTestCaseRequest.setVersionId(apiTestCaseDTO.getVersionId()); + checkNameExist(saveApiTestCaseRequest); + } + } List cannotReductionAPiName = new ArrayList<>(); if (CollectionUtils.isNotEmpty(ids)) { List cannotReductionApiCaseList = extApiTestCaseMapper.getCannotReductionApiCaseList(ids); diff --git a/frontend/src/business/components/api/definition/components/list/ApiCaseSimpleList.vue b/frontend/src/business/components/api/definition/components/list/ApiCaseSimpleList.vue index 084683daa9..dacc1dc575 100644 --- a/frontend/src/business/components/api/definition/components/list/ApiCaseSimpleList.vue +++ b/frontend/src/business/components/api/definition/components/list/ApiCaseSimpleList.vue @@ -92,18 +92,29 @@ - + + + + +