From b4c453b4b53b49decb96138e42fedbd5ae9399d8 Mon Sep 17 00:00:00 2001 From: junjie Date: Tue, 7 Dec 2021 16:23:20 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E6=95=B0=E6=8D=AE=E5=85=B3?= =?UTF-8?q?=E8=81=94=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/dataset/DataSetTableService.java | 20 +++++-------------- 1 file changed, 5 insertions(+), 15 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 ce119736ac..284343fd47 100644 --- a/backend/src/main/java/io/dataease/service/dataset/DataSetTableService.java +++ b/backend/src/main/java/io/dataease/service/dataset/DataSetTableService.java @@ -816,17 +816,12 @@ public class DataSetTableService { List fieldList = (List) sqlMap.get("field"); List join = (List) sqlMap.get("join"); - // 处理结果 - DatasourceProvider datasourceProvider = ProviderFactory.getProvider(ds.getType()); - // 使用输入的sql先预执行一次,并拿到所有字段 - datasourceRequest.setQuery(sql); - Map res = new HashMap<>(); + // 处理结果 try { - List previewFields = datasourceProvider.fetchResultField(datasourceRequest); - QueryProvider qp = ProviderFactory.getQueryProvider(ds.getType()); - datasourceRequest.setQuery(qp.createSQLPreview(sql, previewFields.get(0).getFieldName())); + DatasourceProvider datasourceProvider = ProviderFactory.getProvider(ds.getType()); + datasourceRequest.setQuery(qp.createSQLPreview(sql, null)); Map result = datasourceProvider.fetchResultAndField(datasourceRequest); List data = result.get("dataList"); List fields = result.get("fieldList"); @@ -878,16 +873,11 @@ public class DataSetTableService { datasourceRequest.setDatasource(ds); sql = getCustomSQLDoris(dataTableInfoDTO, list); } - DatasourceProvider datasourceProvider = ProviderFactory.getProvider(ds.getType()); - // 使用输入的sql先预执行一次,并拿到所有字段 - datasourceRequest.setQuery(sql); - Map res = new HashMap<>(); try { - List previewFields = datasourceProvider.fetchResultField(datasourceRequest); - + DatasourceProvider datasourceProvider = ProviderFactory.getProvider(ds.getType()); QueryProvider qp = ProviderFactory.getQueryProvider(ds.getType()); - datasourceRequest.setQuery(qp.createSQLPreview(sql, previewFields.get(0).getFieldName())); + datasourceRequest.setQuery(qp.createSQLPreview(sql, null)); Map result = datasourceProvider.fetchResultAndField(datasourceRequest); List data = result.get("dataList"); List fields = result.get("fieldList");