Merge pull request #7576 from dataease/pr@dev@feat_page

feat: sqlServer根据版本区分明细表分页模式
This commit is contained in:
Junjun 2024-01-10 17:36:19 +08:00 committed by GitHub
commit baa202f883
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 23 additions and 3 deletions

View File

@ -294,7 +294,7 @@ public class ChartViewService {
if (ObjectUtils.isNotEmpty(datasetTable)) { if (ObjectUtils.isNotEmpty(datasetTable)) {
result.setDatasetMode(datasetTable.getMode()); result.setDatasetMode(datasetTable.getMode());
Datasource datasource = datasourceService.get(datasetTable.getDataSourceId()); Datasource datasource = datasourceService.get(datasetTable.getDataSourceId());
result.setDatasourceType(datasource != null ? datasource.getType() : null); buildDsType(datasource, result);
} }
return result; return result;
} catch (Exception e) { } catch (Exception e) {
@ -322,7 +322,7 @@ public class ChartViewService {
if (ObjectUtils.isNotEmpty(datasetTable)) { if (ObjectUtils.isNotEmpty(datasetTable)) {
view.setDatasetMode(datasetTable.getMode()); view.setDatasetMode(datasetTable.getMode());
Datasource datasource = datasourceService.get(datasetTable.getDataSourceId()); 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())) { if (CommonConstants.VIEW_RESULT_MODE.CUSTOM.equals(request.getResultMode())) {
@ -2349,4 +2349,24 @@ public class ChartViewService {
view.setCustomFilter(gson.toJson(tree)); 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);
}
}
} }

View File

@ -1216,7 +1216,7 @@ export const CHART_FONT_LETTER_SPACE = [
{ name: '10px', value: '10' } { 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'] export const SUPPORT_Y_M = ['y', 'y_M', 'y_M_d']