fix(通用功能): 修复用例批量移动其他版本数据跟随问题

--bug=1021055--user=郭雨琦
https://www.tapd.cn/55049933/bugtrace/bugs/view/1155049933001021055
This commit is contained in:
guoyuqi 2022-12-21 16:05:55 +08:00 committed by xiaomeinvG
parent ccaaeb4b08
commit 39ef018d71
3 changed files with 27 additions and 0 deletions

View File

@ -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")) {

View File

@ -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);

View File

@ -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);
}
});
}
}
}