diff --git a/api-test/backend/src/main/java/io/metersphere/service/definition/ApiDefinitionService.java b/api-test/backend/src/main/java/io/metersphere/service/definition/ApiDefinitionService.java index 79f42e5133..57b7736ca6 100644 --- a/api-test/backend/src/main/java/io/metersphere/service/definition/ApiDefinitionService.java +++ b/api-test/backend/src/main/java/io/metersphere/service/definition/ApiDefinitionService.java @@ -1095,6 +1095,12 @@ public class ApiDefinitionService { } apiDefinitionRequest.setVersionId(api.getVersionId()); checkNameExist(apiDefinitionRequest, false); + //同步修改所有版本的模块路径 + if (StringUtils.isNotEmpty(request.getModuleId()) && StringUtils.isNotEmpty(request.getModulePath())) { + api.setModuleId(request.getModuleId()); + api.setModulePath(request.getModulePath()); + updateOtherVersionModule(api); + } }); if (StringUtils.isNotEmpty(request.getFollow())) { if (StringUtils.equals(request.getFollow(), "cancel")) { diff --git a/api-test/backend/src/main/java/io/metersphere/service/scenario/ApiScenarioService.java b/api-test/backend/src/main/java/io/metersphere/service/scenario/ApiScenarioService.java index 7bd3d1e3aa..b9f92c34d1 100644 --- a/api-test/backend/src/main/java/io/metersphere/service/scenario/ApiScenarioService.java +++ b/api-test/backend/src/main/java/io/metersphere/service/scenario/ApiScenarioService.java @@ -1139,6 +1139,11 @@ public class ApiScenarioService { scenarioRequest.setModulePath(request.getModulePath()); scenarioRequest.setVersionId(scenario.getVersionId()); checkNameExist(scenarioRequest, false); + if (StringUtils.isNotEmpty(request.getApiScenarioModuleId()) && StringUtils.isNotEmpty(request.getModulePath())) { + scenario.setApiScenarioModuleId(request.getApiScenarioModuleId()); + scenario.setModulePath(request.getModulePath()); + updateOtherVersionModule(scenario.getRefId(), scenario); + } }); } apiScenarioMapper.updateByExampleSelective(apiScenarioWithBLOBs, apiScenarioExample); diff --git a/test-track/backend/src/main/java/io/metersphere/service/TestCaseService.java b/test-track/backend/src/main/java/io/metersphere/service/TestCaseService.java index 5ce24bfaae..58acf5443b 100644 --- a/test-track/backend/src/main/java/io/metersphere/service/TestCaseService.java +++ b/test-track/backend/src/main/java/io/metersphere/service/TestCaseService.java @@ -1857,6 +1857,22 @@ public class TestCaseService { BeanUtils.copyBean(batchEdit, request); batchEdit.setUpdateTime(System.currentTimeMillis()); bathUpdateByCondition(request, batchEdit); + //批量修改选中数据其他版本的模块路径 + if (request != null && (request.getIds() != null || !request.getIds().isEmpty())) { + request.getIds().forEach(testCaseId -> { + TestCaseWithBLOBs testCaseWithBLOBs = testCaseMapper.selectByPrimaryKey(testCaseId); + if (testCaseWithBLOBs == null) { + return; + } + if (StringUtils.isNotEmpty(request.getNodeId()) && StringUtils.isNotEmpty(request.getNodePath())) { + testCaseWithBLOBs.setNodeId(request.getNodeId()); + testCaseWithBLOBs.setNodePath(request.getNodePath()); + EditTestCaseRequest editTestCaseRequest = new EditTestCaseRequest(); + BeanUtils.copyBean(editTestCaseRequest, testCaseWithBLOBs); + updateOtherVersionModule(editTestCaseRequest); + } + }); + } } }