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; });