fix(接口定义): 快捷调试默认放到bug目录下
This commit is contained in:
parent
21935279ce
commit
ea79196478
|
@ -29,6 +29,12 @@ public class ApiModuleController {
|
|||
return apiModuleService.getNodeTreeByProjectId(projectId,protocol);
|
||||
}
|
||||
|
||||
@GetMapping("/getModuleByName/{projectId}/{protocol}")
|
||||
public ApiModule getModuleByName(@PathVariable String projectId,@PathVariable String protocol) {
|
||||
checkPermissionService.checkProjectOwner(projectId);
|
||||
return apiModuleService.getModuleByName(projectId,protocol);
|
||||
}
|
||||
|
||||
@GetMapping("/list/plan/{planId}/{protocol}")
|
||||
public List<ApiModuleDTO> getNodeByPlanId(@PathVariable String planId, @PathVariable String protocol) {
|
||||
checkPermissionService.checkTestPlanOwner(planId);
|
||||
|
|
|
@ -332,5 +332,27 @@ public class ApiModuleService extends NodeTreeService<ApiModuleDTO> {
|
|||
sqlSession.flushStatements();
|
||||
}
|
||||
|
||||
|
||||
public ApiModule getModuleByName(String projectId, String protocol) {
|
||||
ApiModuleExample example = new ApiModuleExample();
|
||||
ApiModuleExample.Criteria criteria = example.createCriteria();
|
||||
criteria.andNameEqualTo("bug")
|
||||
.andProjectIdEqualTo(projectId).andProtocolEqualTo(protocol);
|
||||
List<ApiModule> modules = apiModuleMapper.selectByExample(example);
|
||||
if (CollectionUtils.isNotEmpty(modules)) {
|
||||
return modules.get(0);
|
||||
} else {
|
||||
ApiModule node = new ApiModule();
|
||||
node.setName("bug");
|
||||
node.setLevel(1);
|
||||
node.setPos(0.0);
|
||||
node.setParentId(null);
|
||||
node.setProjectId(projectId);
|
||||
node.setProtocol(protocol);
|
||||
node.setCreateTime(System.currentTimeMillis());
|
||||
node.setUpdateTime(System.currentTimeMillis());
|
||||
node.setId(UUID.randomUUID().toString());
|
||||
apiModuleMapper.insertSelective(node);
|
||||
return node;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -250,9 +250,19 @@
|
|||
data.method = data.protocol;
|
||||
}
|
||||
},
|
||||
saveApi(row) {
|
||||
addModule(row) {
|
||||
let url = '/api/module/getModuleByName/' + getCurrentProjectID() + "/" + this.api.protocol;
|
||||
this.$get(url, response => {
|
||||
if (response.data) {
|
||||
this.saveApi(row, response.data);
|
||||
}
|
||||
});
|
||||
},
|
||||
saveApi(row, module) {
|
||||
let data = this.api;
|
||||
data.name = this.apiCase.name;
|
||||
data.moduleId = module.id;
|
||||
data.modulePath = '/bug';
|
||||
this.setParameters(data);
|
||||
let bodyFiles = this.getBodyUploadFiles(data);
|
||||
this.$fileUpload("/api/definition/create", null, bodyFiles, data, () => {
|
||||
|
@ -296,7 +306,7 @@
|
|||
},
|
||||
saveTestCase(row) {
|
||||
if (this.api.saved) {
|
||||
this.saveApi(row);
|
||||
this.addModule(row);
|
||||
} else {
|
||||
this.saveCase(row);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue