From 4d617a7b4aa91ab9c3ee600a761ac8f0c26ea765 Mon Sep 17 00:00:00 2001 From: CaptainB Date: Mon, 10 Jan 2022 13:35:33 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=8E=A5=E5=8F=A3=E5=AE=9A=E4=B9=89):=20?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=BF=AB=E6=8D=B7=E8=B0=83=E8=AF=95=E5=88=9B?= =?UTF-8?q?=E5=BB=BA=E5=87=BA=E6=9D=A5=E7=9A=84case=E6=B2=A1=E6=9C=89?= =?UTF-8?q?=E7=89=88=E6=9C=AC=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1009483 --user=刘瑞斌 【接口测试】通过快捷调试的方式创建的接口用例,没有关联上最新的版本 https://www.tapd.cn/55049933/s/1089867 --- .../java/io/metersphere/api/service/ApiTestCaseService.java | 5 +++++ 1 file changed, 5 insertions(+) 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 29f81f7fc2..b3ef8569d5 100644 --- a/backend/src/main/java/io/metersphere/api/service/ApiTestCaseService.java +++ b/backend/src/main/java/io/metersphere/api/service/ApiTestCaseService.java @@ -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 bodyFiles) { + if (StringUtils.isBlank(request.getVersionId())) { + request.setVersionId(extProjectVersionMapper.getDefaultVersion(request.getProjectId())); + } ApiTestCase test = createTest(request, bodyFiles); return test; }