From c2e9d63a1bc03e03fab9bb0ab998e8d9573bdb3d Mon Sep 17 00:00:00 2001 From: shiziyuan9527 Date: Wed, 24 Nov 2021 10:52:34 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=B5=8B=E8=AF=95=E8=AE=A1=E5=88=92):=20?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E7=94=A8=E4=BE=8B=E6=89=B9=E9=87=8F=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E7=8E=AF=E5=A2=83=E4=B8=BA=E7=8E=AF=E5=A2=83=E7=BB=84?= =?UTF-8?q?=E6=9C=AA=E7=94=9F=E6=95=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1008300 --user=lyh 【测试跟踪】测试计划-接口用例,批量编辑,修改环境-选择环境组,没有生效 https://www.tapd.cn/55049933/s/1073876 --- .../testcase/TestPlanApiCaseBatchRequest.java | 2 ++ .../track/service/TestPlanApiCaseService.java | 12 ++++++++++-- .../plan/view/comonents/api/TestPlanApiCaseList.vue | 2 ++ 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/backend/src/main/java/io/metersphere/track/request/testcase/TestPlanApiCaseBatchRequest.java b/backend/src/main/java/io/metersphere/track/request/testcase/TestPlanApiCaseBatchRequest.java index 95e4d92d1a..110a9e3328 100644 --- a/backend/src/main/java/io/metersphere/track/request/testcase/TestPlanApiCaseBatchRequest.java +++ b/backend/src/main/java/io/metersphere/track/request/testcase/TestPlanApiCaseBatchRequest.java @@ -23,4 +23,6 @@ public class TestPlanApiCaseBatchRequest extends TestPlanTestCase { private Map projectEnvMap; private ApiCaseBatchCondition condition; + private String environmentType; + private String environmentGroupId; } diff --git a/backend/src/main/java/io/metersphere/track/service/TestPlanApiCaseService.java b/backend/src/main/java/io/metersphere/track/service/TestPlanApiCaseService.java index b5e0af62ad..32def2db8f 100644 --- a/backend/src/main/java/io/metersphere/track/service/TestPlanApiCaseService.java +++ b/backend/src/main/java/io/metersphere/track/service/TestPlanApiCaseService.java @@ -233,12 +233,20 @@ public class TestPlanApiCaseService { Map rows = request.getSelectRows(); Set ids = rows.keySet(); request.setIds(new ArrayList<>(ids)); - Map env = request.getProjectEnvMap(); + Map env = new HashMap<>(); + String environmentType = request.getEnvironmentType(); + String environmentGroupId = request.getEnvironmentGroupId(); + if (StringUtils.equals(environmentType, EnvironmentType.JSON.name())) { + env = request.getProjectEnvMap(); + } else if (StringUtils.equals(environmentType, EnvironmentType.GROUP.name()) && StringUtils.isNotBlank(environmentGroupId)) { + env = environmentGroupProjectService.getEnvMap(environmentGroupId); + } if (env != null && !env.isEmpty()) { + Map finalEnv = env; ids.forEach(id -> { TestPlanApiCase apiCase = new TestPlanApiCase(); apiCase.setId(id); - apiCase.setEnvironmentId(env.get(rows.get(id))); + apiCase.setEnvironmentId(finalEnv.get(rows.get(id))); testPlanApiCaseMapper.updateByPrimaryKeySelective(apiCase); }); } diff --git a/frontend/src/business/components/track/plan/view/comonents/api/TestPlanApiCaseList.vue b/frontend/src/business/components/track/plan/view/comonents/api/TestPlanApiCaseList.vue index fb6101da54..76c325952a 100644 --- a/frontend/src/business/components/track/plan/view/comonents/api/TestPlanApiCaseList.vue +++ b/frontend/src/business/components/track/plan/view/comonents/api/TestPlanApiCaseList.vue @@ -542,6 +542,8 @@ export default { let dataRows = response.data; let map = new Map(); param.projectEnvMap = strMapToObj(form.projectEnvMap); + param.environmentType = form.environmentType; + param.environmentGroupId = form.envGroupId; dataRows.forEach(row => { map[row.id] = row.projectId; });