Merge pull request #2391 from dataease/pr@dev@fix_filter_sort

fix: 过滤器枚举字段去除分组查询
This commit is contained in:
fit2cloud-chenyw 2022-06-07 19:40:52 +08:00 committed by GitHub
commit aae1fef98b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -135,18 +135,18 @@ public class DirectFieldService implements DataSetFieldService {
QueryProvider qp = ProviderFactory.getQueryProvider(ds.getType()); QueryProvider qp = ProviderFactory.getQueryProvider(ds.getType());
if (StringUtils.equalsIgnoreCase(datasetTable.getType(), "db")) { if (StringUtils.equalsIgnoreCase(datasetTable.getType(), "db")) {
datasourceRequest.setTable(dataTableInfoDTO.getTable()); datasourceRequest.setTable(dataTableInfoDTO.getTable());
datasourceRequest.setQuery(qp.createQuerySQL(dataTableInfoDTO.getTable(), permissionFields, true, ds, customFilter, deSortFields)); datasourceRequest.setQuery(qp.createQuerySQL(dataTableInfoDTO.getTable(), permissionFields, false, ds, customFilter, deSortFields));
} else if (StringUtils.equalsIgnoreCase(datasetTable.getType(), "sql")) { } else if (StringUtils.equalsIgnoreCase(datasetTable.getType(), "sql")) {
datasourceRequest.setQuery(qp.createQuerySQLAsTmp(dataTableInfoDTO.getSql(), permissionFields, true, customFilter, deSortFields)); datasourceRequest.setQuery(qp.createQuerySQLAsTmp(dataTableInfoDTO.getSql(), permissionFields, false, customFilter, deSortFields));
} else if (StringUtils.equalsIgnoreCase(datasetTable.getType(), "custom")) { } else if (StringUtils.equalsIgnoreCase(datasetTable.getType(), "custom")) {
DataTableInfoDTO dt = new Gson().fromJson(datasetTable.getInfo(), DataTableInfoDTO.class); DataTableInfoDTO dt = new Gson().fromJson(datasetTable.getInfo(), DataTableInfoDTO.class);
List<DataSetTableUnionDTO> listUnion = dataSetTableUnionService.listByTableId(dt.getList().get(0).getTableId()); List<DataSetTableUnionDTO> listUnion = dataSetTableUnionService.listByTableId(dt.getList().get(0).getTableId());
String sql = dataSetTableService.getCustomSQLDatasource(dt, listUnion, ds); String sql = dataSetTableService.getCustomSQLDatasource(dt, listUnion, ds);
datasourceRequest.setQuery(qp.createQuerySQLAsTmp(sql, permissionFields, true, customFilter, deSortFields)); datasourceRequest.setQuery(qp.createQuerySQLAsTmp(sql, permissionFields, false, customFilter, deSortFields));
} else if (StringUtils.equalsIgnoreCase(datasetTable.getType(), "union")) { } else if (StringUtils.equalsIgnoreCase(datasetTable.getType(), "union")) {
DataTableInfoDTO dt = new Gson().fromJson(datasetTable.getInfo(), DataTableInfoDTO.class); DataTableInfoDTO dt = new Gson().fromJson(datasetTable.getInfo(), DataTableInfoDTO.class);
String sql = (String) dataSetTableService.getUnionSQLDatasource(dt, ds).get("sql"); String sql = (String) dataSetTableService.getUnionSQLDatasource(dt, ds).get("sql");
datasourceRequest.setQuery(qp.createQuerySQLAsTmp(sql, permissionFields, true, customFilter, deSortFields)); datasourceRequest.setQuery(qp.createQuerySQLAsTmp(sql, permissionFields, false, customFilter, deSortFields));
} }
} else if (datasetTable.getMode() == 1) {// 抽取 } else if (datasetTable.getMode() == 1) {// 抽取
// 连接doris构建doris数据源查询 // 连接doris构建doris数据源查询
@ -157,7 +157,7 @@ public class DirectFieldService implements DataSetFieldService {
String tableName = "ds_" + datasetTable.getId().replaceAll("-", "_"); String tableName = "ds_" + datasetTable.getId().replaceAll("-", "_");
datasourceRequest.setTable(tableName); datasourceRequest.setTable(tableName);
QueryProvider qp = ProviderFactory.getQueryProvider(ds.getType()); QueryProvider qp = ProviderFactory.getQueryProvider(ds.getType());
datasourceRequest.setQuery(qp.createQuerySQL(tableName, permissionFields, true, null, customFilter)); datasourceRequest.setQuery(qp.createQuerySQL(tableName, permissionFields, false, null, customFilter));
} }
List<String[]> rows = datasourceProvider.getData(datasourceRequest); List<String[]> rows = datasourceProvider.getData(datasourceRequest);