fix: 去除重名变量

This commit is contained in:
taojinlong 2022-08-29 11:44:40 +08:00
parent 7edebc36cd
commit a28ab4e81a

View File

@ -946,13 +946,20 @@ public class DataSetTableService {
if (CollectionUtils.isEmpty(datasetTables)) {
return new ArrayList<>();
}
List<SqlVariableDetails> sqlVariableDetails = new ArrayList<>();
List<String> sqlVariableNames = new ArrayList<>();
datasetTables.forEach(datasetTable -> {
if (StringUtils.isNotEmpty(datasetTable.getSqlVariableDetails())) {
sqlVariableDetails.addAll(new Gson().fromJson(datasetTable.getSqlVariableDetails(), new TypeToken<List<SqlVariableDetails>>() {
}.getType()));
List<SqlVariableDetails> sqlVariables = new Gson().fromJson(datasetTable.getSqlVariableDetails(), new TypeToken<List<SqlVariableDetails>>() {}.getType());
for (SqlVariableDetails sqlVariable : sqlVariables) {
if(!sqlVariableNames.contains(sqlVariable.getVariableName())){
sqlVariableNames.add(sqlVariable.getVariableName());
sqlVariableDetails.add(sqlVariable);
}
}
}
});
return sqlVariableDetails;
}