fix: 修复复制接口用例的时候版本不对的问题

--bug=1009772 --user=刘瑞斌 [接口定义]-复制一个版本v1的接口CASE,复制后的CASE版本是最新版本不是原CASE版本 https://www.tapd.cn/55049933/s/1094581
This commit is contained in:
CaptainB 2022-01-19 17:55:13 +08:00 committed by 刘瑞斌
parent 9ace668e32
commit d0fc490581
3 changed files with 5 additions and 0 deletions

View File

@ -328,6 +328,9 @@ public class ApiTestCaseService {
if (StringUtils.isNotBlank(request.getId())) { if (StringUtils.isNotBlank(request.getId())) {
criteria.andIdNotEqualTo(request.getId()); criteria.andIdNotEqualTo(request.getId());
} }
if (StringUtils.isNotBlank(request.getVersionId())) {
criteria.andVersionIdEqualTo(request.getVersionId());
}
List<ApiTestCase> apiTestCases = apiTestCaseMapper.selectByExample(example); List<ApiTestCase> apiTestCases = apiTestCaseMapper.selectByExample(example);
if (CollectionUtils.isNotEmpty(apiTestCases)) { if (CollectionUtils.isNotEmpty(apiTestCases)) {
return apiTestCases.get(0); return apiTestCases.get(0);

View File

@ -150,6 +150,7 @@ export default {
}, },
copy(apiCase) { copy(apiCase) {
this.api.id = apiCase.apiDefinitionId; this.api.id = apiCase.apiDefinitionId;
this.api.versionId = apiCase.versionId;
if (apiCase && apiCase.request) { if (apiCase && apiCase.request) {
if (apiCase.request.type === "HTTPSamplerProxy") { if (apiCase.request.type === "HTTPSamplerProxy") {
this.api.protocol = "HTTP"; this.api.protocol = "HTTP";

View File

@ -836,6 +836,7 @@ export default {
let obj = { let obj = {
name: "copy_" + data.name, name: "copy_" + data.name,
apiDefinitionId: row.apiDefinitionId, apiDefinitionId: row.apiDefinitionId,
versionId: data.versionId,
priority: data.priority, priority: data.priority,
active: true, active: true,
tags: data.tags, tags: data.tags,