diff --git a/backend/src/main/java/io/dataease/service/dataset/DataSetTableService.java b/backend/src/main/java/io/dataease/service/dataset/DataSetTableService.java index d65c5436b3..faa5a69215 100644 --- a/backend/src/main/java/io/dataease/service/dataset/DataSetTableService.java +++ b/backend/src/main/java/io/dataease/service/dataset/DataSetTableService.java @@ -946,13 +946,20 @@ public class DataSetTableService { if (CollectionUtils.isEmpty(datasetTables)) { return new ArrayList<>(); } + + List sqlVariableDetails = new ArrayList<>(); + List sqlVariableNames = new ArrayList<>(); datasetTables.forEach(datasetTable -> { if (StringUtils.isNotEmpty(datasetTable.getSqlVariableDetails())) { - sqlVariableDetails.addAll(new Gson().fromJson(datasetTable.getSqlVariableDetails(), new TypeToken>() { - }.getType())); + List sqlVariables = new Gson().fromJson(datasetTable.getSqlVariableDetails(), new TypeToken>() {}.getType()); + for (SqlVariableDetails sqlVariable : sqlVariables) { + if(!sqlVariableNames.contains(sqlVariable.getVariableName())){ + sqlVariableNames.add(sqlVariable.getVariableName()); + sqlVariableDetails.add(sqlVariable); + } + } } - }); return sqlVariableDetails; }