fix(测试计划): 接口用例批量修改环境为环境组未生效
--bug=1008300 --user=lyh 【测试跟踪】测试计划-接口用例,批量编辑,修改环境-选择环境组,没有生效 https://www.tapd.cn/55049933/s/1073876
This commit is contained in:
parent
8a0b3da88a
commit
c2e9d63a1b
|
@ -23,4 +23,6 @@ public class TestPlanApiCaseBatchRequest extends TestPlanTestCase {
|
||||||
private Map<String, String> projectEnvMap;
|
private Map<String, String> projectEnvMap;
|
||||||
|
|
||||||
private ApiCaseBatchCondition condition;
|
private ApiCaseBatchCondition condition;
|
||||||
|
private String environmentType;
|
||||||
|
private String environmentGroupId;
|
||||||
}
|
}
|
||||||
|
|
|
@ -233,12 +233,20 @@ public class TestPlanApiCaseService {
|
||||||
Map<String, String> rows = request.getSelectRows();
|
Map<String, String> rows = request.getSelectRows();
|
||||||
Set<String> ids = rows.keySet();
|
Set<String> ids = rows.keySet();
|
||||||
request.setIds(new ArrayList<>(ids));
|
request.setIds(new ArrayList<>(ids));
|
||||||
Map<String, String> env = request.getProjectEnvMap();
|
Map<String, String> 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()) {
|
if (env != null && !env.isEmpty()) {
|
||||||
|
Map<String, String> finalEnv = env;
|
||||||
ids.forEach(id -> {
|
ids.forEach(id -> {
|
||||||
TestPlanApiCase apiCase = new TestPlanApiCase();
|
TestPlanApiCase apiCase = new TestPlanApiCase();
|
||||||
apiCase.setId(id);
|
apiCase.setId(id);
|
||||||
apiCase.setEnvironmentId(env.get(rows.get(id)));
|
apiCase.setEnvironmentId(finalEnv.get(rows.get(id)));
|
||||||
testPlanApiCaseMapper.updateByPrimaryKeySelective(apiCase);
|
testPlanApiCaseMapper.updateByPrimaryKeySelective(apiCase);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -542,6 +542,8 @@ export default {
|
||||||
let dataRows = response.data;
|
let dataRows = response.data;
|
||||||
let map = new Map();
|
let map = new Map();
|
||||||
param.projectEnvMap = strMapToObj(form.projectEnvMap);
|
param.projectEnvMap = strMapToObj(form.projectEnvMap);
|
||||||
|
param.environmentType = form.environmentType;
|
||||||
|
param.environmentGroupId = form.envGroupId;
|
||||||
dataRows.forEach(row => {
|
dataRows.forEach(row => {
|
||||||
map[row.id] = row.projectId;
|
map[row.id] = row.projectId;
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue