From 6511aa0bf0ca94265df925eb6de01b109a7c1f2d Mon Sep 17 00:00:00 2001 From: junjun Date: Wed, 10 Jan 2024 17:35:00 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20sqlServer=E6=A0=B9=E6=8D=AE=E7=89=88?= =?UTF-8?q?=E6=9C=AC=E5=8C=BA=E5=88=86=E6=98=8E=E7=BB=86=E8=A1=A8=E5=88=86?= =?UTF-8?q?=E9=A1=B5=E6=A8=A1=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/chart/ChartViewService.java | 24 +++++++++++++++++-- core/frontend/src/views/chart/chart/chart.js | 2 +- 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/core/backend/src/main/java/io/dataease/service/chart/ChartViewService.java b/core/backend/src/main/java/io/dataease/service/chart/ChartViewService.java index 78c4d47b4a..0716e5355f 100644 --- a/core/backend/src/main/java/io/dataease/service/chart/ChartViewService.java +++ b/core/backend/src/main/java/io/dataease/service/chart/ChartViewService.java @@ -294,7 +294,7 @@ public class ChartViewService { if (ObjectUtils.isNotEmpty(datasetTable)) { result.setDatasetMode(datasetTable.getMode()); Datasource datasource = datasourceService.get(datasetTable.getDataSourceId()); - result.setDatasourceType(datasource != null ? datasource.getType() : null); + buildDsType(datasource, result); } return result; } catch (Exception e) { @@ -322,7 +322,7 @@ public class ChartViewService { if (ObjectUtils.isNotEmpty(datasetTable)) { view.setDatasetMode(datasetTable.getMode()); Datasource datasource = datasourceService.get(datasetTable.getDataSourceId()); - view.setDatasourceType(datasource != null ? datasource.getType() : null); + buildDsType(datasource, view); } // 如果是从仪表板获取视图数据,则仪表板的查询模式,查询结果的数量,覆盖视图对应的属性 if (CommonConstants.VIEW_RESULT_MODE.CUSTOM.equals(request.getResultMode())) { @@ -2349,4 +2349,24 @@ public class ChartViewService { view.setCustomFilter(gson.toJson(tree)); } } + + public void buildDsType(Datasource datasource, ChartViewDTO result) { + if (datasource != null) { + if (StringUtils.equalsIgnoreCase(datasource.getType(), "sqlServer")) { + if (datasource.getVersion() == null) { + result.setDatasourceType(datasource.getType()); + } else { + if (Integer.parseInt(datasource.getVersion()) < 11) { + result.setDatasourceType(datasource.getType() + "_all"); + } else { + result.setDatasourceType(datasource.getType()); + } + } + } else { + result.setDatasourceType(datasource.getType()); + } + } else { + result.setDatasourceType(null); + } + } } diff --git a/core/frontend/src/views/chart/chart/chart.js b/core/frontend/src/views/chart/chart/chart.js index 91c3451899..d790f5510d 100644 --- a/core/frontend/src/views/chart/chart/chart.js +++ b/core/frontend/src/views/chart/chart/chart.js @@ -1216,7 +1216,7 @@ export const CHART_FONT_LETTER_SPACE = [ { name: '10px', value: '10' } ] -export const NOT_SUPPORT_PAGE_DATASET = ['kylin', 'es', 'presto', 'StarRocks'] +export const NOT_SUPPORT_PAGE_DATASET = ['kylin', 'sqlServer_all', 'es', 'presto', 'StarRocks'] export const SUPPORT_Y_M = ['y', 'y_M', 'y_M_d']