fix(接口定义): 修复快捷调试创建出来的case没有版本的问题

--bug=1009483 --user=刘瑞斌 【接口测试】通过快捷调试的方式创建的接口用例,没有关联上最新的版本 https://www.tapd.cn/55049933/s/1089867
This commit is contained in:
CaptainB 2022-01-10 13:35:33 +08:00 committed by 刘瑞斌
parent b5636d84bf
commit 4d617a7b4a
1 changed files with 5 additions and 0 deletions

View File

@ -98,6 +98,8 @@ public class ApiTestCaseService {
private ApiTestEnvironmentMapper apiTestEnvironmentMapper;
@Resource
private ApiTestCaseFollowMapper apiTestCaseFollowMapper;
@Resource
private ExtProjectVersionMapper extProjectVersionMapper;
private static final String BODY_FILE_DIR = FileUtils.BODY_FILE_DIR;
@ -232,6 +234,9 @@ public class ApiTestCaseService {
}
public ApiTestCase create(SaveApiTestCaseRequest request, List<MultipartFile> bodyFiles) {
if (StringUtils.isBlank(request.getVersionId())) {
request.setVersionId(extProjectVersionMapper.getDefaultVersion(request.getProjectId()));
}
ApiTestCase test = createTest(request, bodyFiles);
return test;
}