diff --git a/backend/src/main/java/io/metersphere/api/service/ApiTestCaseService.java b/backend/src/main/java/io/metersphere/api/service/ApiTestCaseService.java index 3d4a636615..c3e9c2d35d 100644 --- a/backend/src/main/java/io/metersphere/api/service/ApiTestCaseService.java +++ b/backend/src/main/java/io/metersphere/api/service/ApiTestCaseService.java @@ -328,6 +328,9 @@ public class ApiTestCaseService { if (StringUtils.isNotBlank(request.getId())) { criteria.andIdNotEqualTo(request.getId()); } + if (StringUtils.isNotBlank(request.getVersionId())) { + criteria.andVersionIdEqualTo(request.getVersionId()); + } List apiTestCases = apiTestCaseMapper.selectByExample(example); if (CollectionUtils.isNotEmpty(apiTestCases)) { return apiTestCases.get(0); diff --git a/frontend/src/business/components/api/definition/components/case/ApiCaseList.vue b/frontend/src/business/components/api/definition/components/case/ApiCaseList.vue index 9c5d75b155..a7073003e8 100644 --- a/frontend/src/business/components/api/definition/components/case/ApiCaseList.vue +++ b/frontend/src/business/components/api/definition/components/case/ApiCaseList.vue @@ -150,6 +150,7 @@ export default { }, copy(apiCase) { this.api.id = apiCase.apiDefinitionId; + this.api.versionId = apiCase.versionId; if (apiCase && apiCase.request) { if (apiCase.request.type === "HTTPSamplerProxy") { this.api.protocol = "HTTP"; diff --git a/frontend/src/business/components/api/definition/components/list/ApiCaseSimpleList.vue b/frontend/src/business/components/api/definition/components/list/ApiCaseSimpleList.vue index 33661a4d84..63a2874ef4 100644 --- a/frontend/src/business/components/api/definition/components/list/ApiCaseSimpleList.vue +++ b/frontend/src/business/components/api/definition/components/list/ApiCaseSimpleList.vue @@ -836,6 +836,7 @@ export default { let obj = { name: "copy_" + data.name, apiDefinitionId: row.apiDefinitionId, + versionId: data.versionId, priority: data.priority, active: true, tags: data.tags,