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 2d9492ebba..17e3c568d8 100644 --- a/backend/src/main/java/io/metersphere/api/service/ApiTestCaseService.java +++ b/backend/src/main/java/io/metersphere/api/service/ApiTestCaseService.java @@ -346,7 +346,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()); } } @@ -924,7 +924,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 e6f8dd22a3..d7bd887ccd 100644 --- a/frontend/src/business/components/api/definition/components/list/ApiCaseSimpleList.vue +++ b/frontend/src/business/components/api/definition/components/list/ApiCaseSimpleList.vue @@ -90,18 +90,29 @@ - + + + + +