From e6a10f4d9804768b9bcf6d67d3d40929cf683ef5 Mon Sep 17 00:00:00 2001 From: wxg0103 <727495428@qq.com> Date: Thu, 28 Jul 2022 16:18:50 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=8E=A5=E5=8F=A3=E5=AE=9A=E4=B9=89):=20?= =?UTF-8?q?=E4=BB=8E=E5=9B=9E=E6=94=B6=E7=AB=99=E6=81=A2=E5=A4=8D=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=E7=94=A8=E4=BE=8B=E5=A2=9E=E5=8A=A0=E9=87=8D=E5=90=8D?= =?UTF-8?q?=E6=A0=A1=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/service/ApiTestCaseService.java | 16 ++++++++++-- .../components/list/ApiCaseSimpleList.vue | 25 +++++++++++++------ 2 files changed, 32 insertions(+), 9 deletions(-) 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 @@ - + + + + +