diff --git a/backend/src/main/java/io/metersphere/api/service/ApiAutomationService.java b/backend/src/main/java/io/metersphere/api/service/ApiAutomationService.java index ba06d62c15..0364e012b1 100644 --- a/backend/src/main/java/io/metersphere/api/service/ApiAutomationService.java +++ b/backend/src/main/java/io/metersphere/api/service/ApiAutomationService.java @@ -1137,6 +1137,23 @@ public class ApiAutomationService { ApiScenarioWithBLOBs apiScenarioWithBLOBs = new ApiScenarioWithBLOBs(); BeanUtils.copyBean(apiScenarioWithBLOBs, request); apiScenarioWithBLOBs.setUpdateTime(System.currentTimeMillis()); + if (request != null && (request.getIds() != null || !request.getIds().isEmpty())) { + request.getIds().forEach(apiId -> { + ApiScenarioWithBLOBs scenario = apiScenarioMapper.selectByPrimaryKey(apiId); + if (scenario == null) { + return; + } + //检查是否同名 + SaveApiScenarioRequest scenarioRequest = new SaveApiScenarioRequest(); + scenarioRequest.setProjectId(scenario.getProjectId()); + scenarioRequest.setName(scenario.getName()); + scenarioRequest.setId(scenario.getId()); + scenarioRequest.setApiScenarioModuleId(request.getApiScenarioModuleId()); + scenarioRequest.setModulePath(request.getModulePath()); + scenarioRequest.setVersionId(scenario.getVersionId()); + checkNameExist(scenarioRequest, false); + }); + } apiScenarioMapper.updateByExampleSelective( apiScenarioWithBLOBs, apiScenarioExample); diff --git a/backend/src/main/java/io/metersphere/api/service/ApiDefinitionService.java b/backend/src/main/java/io/metersphere/api/service/ApiDefinitionService.java index 9536efdf15..d0e82c0d76 100644 --- a/backend/src/main/java/io/metersphere/api/service/ApiDefinitionService.java +++ b/backend/src/main/java/io/metersphere/api/service/ApiDefinitionService.java @@ -1651,6 +1651,28 @@ public class ApiDefinitionService { ApiDefinitionWithBLOBs definitionWithBLOBs = new ApiDefinitionWithBLOBs(); BeanUtils.copyBean(definitionWithBLOBs, request); definitionWithBLOBs.setUpdateTime(System.currentTimeMillis()); + ServiceUtils.getSelectAllIds(request, request.getCondition(), + (query) -> extApiDefinitionMapper.selectIds(query)); + if (request != null && (request.getIds() != null || !request.getIds().isEmpty())) { + request.getIds().forEach(apiId -> { + ApiDefinitionWithBLOBs api = apiDefinitionMapper.selectByPrimaryKey(apiId); + if (api == null) { + return; + } + //检查是否同名 + SaveApiDefinitionRequest apiDefinitionRequest = new SaveApiDefinitionRequest(); + apiDefinitionRequest.setProjectId(api.getProjectId()); + apiDefinitionRequest.setMethod(api.getMethod()); + apiDefinitionRequest.setProtocol(api.getProtocol()); + apiDefinitionRequest.setPath(api.getPath()); + apiDefinitionRequest.setName(api.getName()); + apiDefinitionRequest.setId(api.getId()); + apiDefinitionRequest.setModuleId(request.getModuleId()); + apiDefinitionRequest.setModulePath(request.getModulePath()); + apiDefinitionRequest.setVersionId(api.getVersionId()); + checkNameExist(apiDefinitionRequest, false); + }); + } apiDefinitionMapper.updateByExampleSelective(definitionWithBLOBs, getBatchExample(request)); } diff --git a/backend/src/main/resources/i18n/messages_en_US.properties b/backend/src/main/resources/i18n/messages_en_US.properties index 65a6efc724..4a5c64a697 100644 --- a/backend/src/main/resources/i18n/messages_en_US.properties +++ b/backend/src/main/resources/i18n/messages_en_US.properties @@ -227,7 +227,7 @@ upload_content_is_null=Imported content is empty test_plan_notification=Test plan notification task_defect_notification=Task defect notification task_notification_=Timing task result notification -api_definition_url_not_repeating=The interface request address already exists under the same module +api_definition_url_not_repeating=The interface request address already exists api_definition_name_not_repeating=The same name-url combination already exists under the same module api_definition_name_already_exists=Interface names under the same module cannot be repeated api_definition_module=The module path is diff --git a/backend/src/main/resources/i18n/messages_zh_CN.properties b/backend/src/main/resources/i18n/messages_zh_CN.properties index 494a926807..853d4630f3 100644 --- a/backend/src/main/resources/i18n/messages_zh_CN.properties +++ b/backend/src/main/resources/i18n/messages_zh_CN.properties @@ -227,7 +227,7 @@ upload_content_is_null=导入内容为空 test_plan_notification=测试计划通知 task_defect_notification=缺陷任务通知 task_notification_=定时任务结果通知 -api_definition_url_not_repeating=同一模块下接口请求地址已经存在 +api_definition_url_not_repeating=接口请求地址已经存在 api_definition_name_not_repeating=同一模块下相同的名称-url组合已存在 api_definition_name_already_exists=同一模块下接口名称不能重复 api_definition_module=模块路径为 diff --git a/backend/src/main/resources/i18n/messages_zh_TW.properties b/backend/src/main/resources/i18n/messages_zh_TW.properties index cd774f1974..14996c86ac 100644 --- a/backend/src/main/resources/i18n/messages_zh_TW.properties +++ b/backend/src/main/resources/i18n/messages_zh_TW.properties @@ -226,7 +226,7 @@ upload_content_is_null=導入內容為空 test_plan_notification=測試計劃通知 task_defect_notification=缺陷任務通知 task_notification_=定時任務結果通知 -api_definition_url_not_repeating=同一模塊下介面請求地址已經存在 +api_definition_url_not_repeating=介面請求地址已經存在 api_definition_name_not_repeating=同一模塊下相同的名稱-url組合已存在 api_definition_name_already_exists=同一模塊下介面名稱不能重複 api_definition_module=模塊路徑為