From b0371abe56fd9c564e951b1c840450f8d4292053 Mon Sep 17 00:00:00 2001 From: wxg0103 <727495428@qq.com> Date: Fri, 4 Aug 2023 13:46:54 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=8E=A5=E5=8F=A3=E6=B5=8B=E8=AF=95):=20?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=AF=BC=E5=85=A5=E7=9A=84case=E7=9A=84reque?= =?UTF-8?q?st=E7=9A=84=E9=A1=B9=E7=9B=AEid=E4=B8=8D=E6=98=AF=E5=BD=93?= =?UTF-8?q?=E5=89=8D=E9=A1=B9=E7=9B=AEid=E7=9A=84=E7=BC=BA=E9=99=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1028195 --user=王孝刚 【接口测试】新建api-新建case-导出-导入到其他项目-case添加前后置sql-环境显示为导出项目环境 https://www.tapd.cn/55049933/s/1400900 --- .../service/definition/ApiDefinitionImportUtilService.java | 5 +++++ .../src/business/definition/components/case/ApiCaseItem.vue | 1 + 2 files changed, 6 insertions(+) diff --git a/api-test/backend/src/main/java/io/metersphere/service/definition/ApiDefinitionImportUtilService.java b/api-test/backend/src/main/java/io/metersphere/service/definition/ApiDefinitionImportUtilService.java index 4e7d40702c..96d2f1a4cc 100644 --- a/api-test/backend/src/main/java/io/metersphere/service/definition/ApiDefinitionImportUtilService.java +++ b/api-test/backend/src/main/java/io/metersphere/service/definition/ApiDefinitionImportUtilService.java @@ -848,6 +848,11 @@ public class ApiDefinitionImportUtilService { apiTestCaseWithBLOBs.setCreateUserId(Objects.requireNonNull(SessionUtils.getUser()).getId()); apiTestCaseWithBLOBs.setUpdateUserId(Objects.requireNonNull(SessionUtils.getUser()).getId()); apiTestCaseWithBLOBs.setCreateTime(System.currentTimeMillis()); + JSONObject o = JSONUtil.parseObject(apiTestCaseWithBLOBs.getRequest()); + if (o != null) { + o.put("projectId", apiTestCaseWithBLOBs.getProjectId()); + apiTestCaseWithBLOBs.setRequest(o.toString()); + } BeanUtils.copyBean(apiTestCaseDTO, apiTestCaseWithBLOBs); apiTestCaseDTO.setUpdated(false); apiTestCaseMapper.insert(apiTestCaseWithBLOBs); diff --git a/api-test/frontend/src/business/definition/components/case/ApiCaseItem.vue b/api-test/frontend/src/business/definition/components/case/ApiCaseItem.vue index d3d07916c1..2fc40b81af 100644 --- a/api-test/frontend/src/business/definition/components/case/ApiCaseItem.vue +++ b/api-test/frontend/src/business/definition/components/case/ApiCaseItem.vue @@ -991,6 +991,7 @@ export default { this.apiCase.request.headers = []; this.apiCase.request.headers.push(new KeyValue({ enable: true, name: '', value: '' })); } + this.apiCase.request.projectId = this.apiCase.projectId; if (this.apiCase.request.hashTree) { this.initStepSize(this.apiCase.request.hashTree); this.historicalDataProcessing(this.apiCase.request.hashTree);