fix(接口测试): 修复快捷调试另存为用例,显示的还是上一次用例名称的缺陷

--bug=1028281 --user=王孝刚 【接口测试】快捷调试-另存为用例页面-接口名称显示上一次另存为用例的名称
https://www.tapd.cn/55049933/s/1400878
This commit is contained in:
wxg0103 2023-08-04 10:56:43 +08:00 committed by fit2-zhao
parent 14081684d6
commit 1ab9c825b7
2 changed files with 12 additions and 3 deletions

View File

@ -917,6 +917,15 @@ public class ApiDefinitionService {
}
private ApiDefinitionResult createTest(SaveApiDefinitionRequest request) {
if (StringUtils.isEmpty(request.getModuleId()) || "default-module".equals(request.getModuleId())) {
ApiModuleExample example = new ApiModuleExample();
example.createCriteria().andProjectIdEqualTo(request.getProjectId()).andProtocolEqualTo(request.getProtocol()).andNameEqualTo(ProjectModuleDefaultNodeEnum.API_MODULE_DEFAULT_NODE.getNodeName()).andLevelEqualTo(1);
List<ApiModule> modules = apiModuleMapper.selectByExample(example);
if (CollectionUtils.isNotEmpty(modules)) {
request.setModuleId(modules.get(0).getId());
request.setModulePath("/未规划接口");
}
}
checkNameExist(request, false);
final ApiDefinitionWithBLOBs test = new ApiDefinitionWithBLOBs();
test.setId(request.getId());
@ -938,9 +947,6 @@ public class ApiDefinitionService {
test.setRefId(request.getId());
test.setVersionId(request.getVersionId());
test.setLatest(true); // 新建一定是最新的
if (StringUtils.isEmpty(request.getModuleId()) || "default-module".equals(request.getModuleId())) {
initModulePathAndId(test.getProjectId(), test);
}
test.setResponse(JSON.toJSONString(request.getResponse()));
test.setEnvironmentId(request.getEnvironmentId());
test.setNum(getNextNum(request.getProjectId()));

View File

@ -268,6 +268,9 @@ export default {
if (api && api.request && api.request.url) {
api.request.url = undefined;
}
if (api && api.name) {
api.name = undefined;
}
this.visible = true;
this.api = api;
if (this.currentApi && api) {