From a28ab4e81a321aebc6122de016f72c1bf4ed7833 Mon Sep 17 00:00:00 2001 From: taojinlong Date: Mon, 29 Aug 2022 11:44:40 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=8E=BB=E9=99=A4=E9=87=8D=E5=90=8D?= =?UTF-8?q?=E5=8F=98=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/dataset/DataSetTableService.java | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) 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; }