forked from github/dataease
Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
commit
4258b29a09
@ -6,6 +6,7 @@ import io.dataease.plugins.common.base.domain.DatasetTableFieldExample;
|
||||
import io.dataease.plugins.common.base.domain.Datasource;
|
||||
import io.dataease.plugins.common.base.mapper.DatasetTableFieldMapper;
|
||||
import io.dataease.plugins.common.constants.CKConstants;
|
||||
import io.dataease.plugins.common.constants.Db2Constants;
|
||||
import io.dataease.plugins.common.constants.DeTypeConstants;
|
||||
import io.dataease.plugins.common.constants.SQLConstants;
|
||||
import io.dataease.plugins.common.dto.chart.ChartCustomFilterItemDTO;
|
||||
@ -1059,6 +1060,8 @@ public class CKQueryProvider extends QueryProvider {
|
||||
} else if (SQLConstants.DIMENSION_TYPE.contains(y.getDeType())) {
|
||||
if (StringUtils.equalsIgnoreCase(y.getSummary(), "count_distinct")) {
|
||||
fieldName = String.format(CKConstants.AGG_FIELD, "COUNT", "DISTINCT " + originField);
|
||||
} else if (StringUtils.equalsIgnoreCase(y.getSummary(), "group_concat")) {
|
||||
fieldName = String.format(CKConstants.GROUP_CONCAT, originField);
|
||||
} else {
|
||||
fieldName = String.format(CKConstants.AGG_FIELD, y.getSummary(), originField);
|
||||
}
|
||||
|
@ -9,6 +9,7 @@ import io.dataease.plugins.common.base.mapper.DatasetTableFieldMapper;
|
||||
import io.dataease.dto.datasource.Db2Configuration;
|
||||
import io.dataease.plugins.common.constants.Db2Constants;
|
||||
import io.dataease.plugins.common.constants.DeTypeConstants;
|
||||
import io.dataease.plugins.common.constants.EsSqlLConstants;
|
||||
import io.dataease.plugins.common.constants.SQLConstants;
|
||||
import io.dataease.plugins.common.dto.chart.ChartCustomFilterItemDTO;
|
||||
import io.dataease.plugins.common.dto.chart.ChartFieldCustomFilterDTO;
|
||||
@ -1029,6 +1030,8 @@ public class Db2QueryProvider extends QueryProvider {
|
||||
} else if (SQLConstants.DIMENSION_TYPE.contains(y.getDeType())) {
|
||||
if (StringUtils.equalsIgnoreCase(y.getSummary(), "count_distinct")) {
|
||||
fieldName = String.format(Db2Constants.AGG_FIELD, "COUNT", "DISTINCT " + originField);
|
||||
} else if (StringUtils.equalsIgnoreCase(y.getSummary(), "group_concat")) {
|
||||
fieldName = String.format(Db2Constants.GROUP_CONCAT, originField);
|
||||
} else {
|
||||
fieldName = String.format(Db2Constants.AGG_FIELD, y.getSummary(), originField);
|
||||
}
|
||||
|
@ -7,6 +7,7 @@ import io.dataease.plugins.common.base.domain.Datasource;
|
||||
import io.dataease.plugins.common.base.mapper.DatasetTableFieldMapper;
|
||||
import io.dataease.plugins.common.constants.DeTypeConstants;
|
||||
import io.dataease.plugins.common.constants.EsSqlLConstants;
|
||||
import io.dataease.plugins.common.constants.HiveConstants;
|
||||
import io.dataease.plugins.common.constants.SQLConstants;
|
||||
import io.dataease.plugins.common.dto.chart.ChartCustomFilterItemDTO;
|
||||
import io.dataease.plugins.common.dto.chart.ChartFieldCustomFilterDTO;
|
||||
@ -1052,6 +1053,8 @@ public class EsQueryProvider extends QueryProvider {
|
||||
} else if (SQLConstants.DIMENSION_TYPE.contains(y.getDeType())) {
|
||||
if (StringUtils.equalsIgnoreCase(y.getSummary(), "count_distinct")) {
|
||||
fieldName = String.format(EsSqlLConstants.AGG_FIELD, "COUNT", "DISTINCT " + originField);
|
||||
} else if (StringUtils.equalsIgnoreCase(y.getSummary(), "group_concat")) {
|
||||
fieldName = String.format(EsSqlLConstants.GROUP_CONCAT, originField);
|
||||
} else {
|
||||
fieldName = String.format(EsSqlLConstants.AGG_FIELD, y.getSummary(), originField);
|
||||
}
|
||||
|
@ -7,6 +7,7 @@ import io.dataease.plugins.common.base.domain.Datasource;
|
||||
import io.dataease.plugins.common.base.mapper.DatasetTableFieldMapper;
|
||||
import io.dataease.plugins.common.constants.DeTypeConstants;
|
||||
import io.dataease.plugins.common.constants.HiveConstants;
|
||||
import io.dataease.plugins.common.constants.ImpalaConstants;
|
||||
import io.dataease.plugins.common.constants.SQLConstants;
|
||||
import io.dataease.plugins.common.dto.chart.ChartCustomFilterItemDTO;
|
||||
import io.dataease.plugins.common.dto.chart.ChartFieldCustomFilterDTO;
|
||||
@ -1027,6 +1028,8 @@ public class HiveQueryProvider extends QueryProvider {
|
||||
} else if (SQLConstants.DIMENSION_TYPE.contains(y.getDeType())) {
|
||||
if (StringUtils.equalsIgnoreCase(y.getSummary(), "count_distinct")) {
|
||||
fieldName = String.format(HiveConstants.AGG_FIELD, "COUNT", "DISTINCT " + originField);
|
||||
} else if (StringUtils.equalsIgnoreCase(y.getSummary(), "group_concat")) {
|
||||
fieldName = String.format(HiveConstants.GROUP_CONCAT, originField);
|
||||
} else {
|
||||
fieldName = String.format(HiveConstants.AGG_FIELD, y.getSummary(), originField);
|
||||
}
|
||||
|
@ -7,6 +7,7 @@ import io.dataease.plugins.common.base.domain.Datasource;
|
||||
import io.dataease.plugins.common.base.mapper.DatasetTableFieldMapper;
|
||||
import io.dataease.plugins.common.constants.DeTypeConstants;
|
||||
import io.dataease.plugins.common.constants.ImpalaConstants;
|
||||
import io.dataease.plugins.common.constants.MongoConstants;
|
||||
import io.dataease.plugins.common.constants.SQLConstants;
|
||||
import io.dataease.plugins.common.dto.chart.ChartCustomFilterItemDTO;
|
||||
import io.dataease.plugins.common.dto.chart.ChartFieldCustomFilterDTO;
|
||||
@ -995,6 +996,8 @@ public class ImpalaQueryProvider extends QueryProvider {
|
||||
} else if (SQLConstants.DIMENSION_TYPE.contains(y.getDeType())) {
|
||||
if (StringUtils.equalsIgnoreCase(y.getSummary(), "count_distinct")) {
|
||||
fieldName = String.format(ImpalaConstants.AGG_FIELD, "COUNT", "DISTINCT " + originField);
|
||||
} else if (StringUtils.equalsIgnoreCase(y.getSummary(), "group_concat")) {
|
||||
fieldName = String.format(ImpalaConstants.GROUP_CONCAT, originField);
|
||||
} else {
|
||||
fieldName = String.format(ImpalaConstants.AGG_FIELD, y.getSummary(), originField);
|
||||
}
|
||||
|
@ -936,6 +936,8 @@ public class MongoQueryProvider extends QueryProvider {
|
||||
} else if (SQLConstants.DIMENSION_TYPE.contains(y.getDeType())) {
|
||||
if (StringUtils.equalsIgnoreCase(y.getSummary(), "count_distinct")) {
|
||||
fieldName = String.format(MongoConstants.AGG_FIELD, "COUNT", "DISTINCT " + originField);
|
||||
} else if (StringUtils.equalsIgnoreCase(y.getSummary(), "group_concat")) {
|
||||
fieldName = String.format(MongoConstants.GROUP_CONCAT, originField);
|
||||
} else {
|
||||
fieldName = String.format(MongoConstants.AGG_FIELD, y.getSummary(), originField);
|
||||
}
|
||||
|
@ -1031,7 +1031,11 @@ public class MysqlQueryProvider extends QueryProvider {
|
||||
} else if (SQLConstants.DIMENSION_TYPE.contains(y.getDeType())) {
|
||||
if (StringUtils.equalsIgnoreCase(y.getSummary(), "count_distinct")) {
|
||||
fieldName = String.format(MySQLConstants.AGG_FIELD, "COUNT", "DISTINCT " + originField);
|
||||
} else {
|
||||
}
|
||||
else if (StringUtils.equalsIgnoreCase(y.getSummary(), "group_concat")) {
|
||||
fieldName = String.format(MySQLConstants.GROUP_CONCAT, originField);
|
||||
}
|
||||
else {
|
||||
fieldName = String.format(MySQLConstants.AGG_FIELD, y.getSummary(), originField);
|
||||
}
|
||||
} else {
|
||||
|
@ -7,6 +7,7 @@ import io.dataease.plugins.common.base.domain.DatasetTableFieldExample;
|
||||
import io.dataease.plugins.common.base.domain.Datasource;
|
||||
import io.dataease.plugins.common.base.mapper.DatasetTableFieldMapper;
|
||||
import io.dataease.dto.datasource.OracleConfiguration;
|
||||
import io.dataease.plugins.common.constants.MySQLConstants;
|
||||
import io.dataease.plugins.common.constants.OracleConstants;
|
||||
import io.dataease.plugins.common.constants.SQLConstants;
|
||||
import io.dataease.plugins.common.dto.chart.ChartCustomFilterItemDTO;
|
||||
@ -1104,7 +1105,10 @@ public class OracleQueryProvider extends QueryProvider {
|
||||
} else if (SQLConstants.DIMENSION_TYPE.contains(y.getDeType())) {
|
||||
if (StringUtils.equalsIgnoreCase(y.getSummary(), "count_distinct")) {
|
||||
fieldName = String.format(OracleConstants.AGG_FIELD, "COUNT", "DISTINCT " + originField);
|
||||
} else {
|
||||
} else if (StringUtils.equalsIgnoreCase(y.getSummary(), "group_concat")) {
|
||||
fieldName = String.format(OracleConstants.GROUP_CONCAT, originField, originField);
|
||||
}
|
||||
else {
|
||||
fieldName = String.format(OracleConstants.AGG_FIELD, y.getSummary(), originField);
|
||||
}
|
||||
} else {
|
||||
|
@ -6,10 +6,7 @@ import io.dataease.plugins.common.base.domain.DatasetTableField;
|
||||
import io.dataease.plugins.common.base.domain.DatasetTableFieldExample;
|
||||
import io.dataease.plugins.common.base.domain.Datasource;
|
||||
import io.dataease.plugins.common.base.mapper.DatasetTableFieldMapper;
|
||||
import io.dataease.plugins.common.constants.DeTypeConstants;
|
||||
import io.dataease.plugins.common.constants.PgConstants;
|
||||
import io.dataease.plugins.common.constants.SQLConstants;
|
||||
import io.dataease.plugins.common.constants.SqlServerSQLConstants;
|
||||
import io.dataease.plugins.common.constants.*;
|
||||
import io.dataease.plugins.common.dto.chart.ChartCustomFilterItemDTO;
|
||||
import io.dataease.plugins.common.dto.chart.ChartFieldCustomFilterDTO;
|
||||
import io.dataease.plugins.common.dto.chart.ChartViewFieldDTO;
|
||||
@ -1021,7 +1018,10 @@ public class PgQueryProvider extends QueryProvider {
|
||||
} else if (SQLConstants.DIMENSION_TYPE.contains(y.getDeType())) {
|
||||
if (StringUtils.equalsIgnoreCase(y.getSummary(), "count_distinct")) {
|
||||
fieldName = String.format(PgConstants.AGG_FIELD, "COUNT", "DISTINCT " + originField);
|
||||
} else {
|
||||
} else if (StringUtils.equalsIgnoreCase(y.getSummary(), "group_concat")) {
|
||||
fieldName = String.format(PgConstants.GROUP_CONCAT, originField);
|
||||
}
|
||||
else {
|
||||
fieldName = String.format(PgConstants.AGG_FIELD, y.getSummary(), originField);
|
||||
}
|
||||
} else {
|
||||
|
@ -944,6 +944,8 @@ public class RedshiftQueryProvider extends QueryProvider {
|
||||
} else if (SQLConstants.DIMENSION_TYPE.contains(y.getDeType())) {
|
||||
if (StringUtils.equalsIgnoreCase(y.getSummary(), "count_distinct")) {
|
||||
fieldName = String.format(PgConstants.AGG_FIELD, "COUNT", "DISTINCT " + originField);
|
||||
} else if (StringUtils.equalsIgnoreCase(y.getSummary(), "group_concat")) {
|
||||
fieldName = String.format(RedshiftConstants.GROUP_CONCAT, originField);
|
||||
} else {
|
||||
fieldName = String.format(PgConstants.AGG_FIELD, y.getSummary(), originField);
|
||||
}
|
||||
|
@ -7,6 +7,7 @@ import io.dataease.plugins.common.base.domain.DatasetTableFieldExample;
|
||||
import io.dataease.plugins.common.base.domain.Datasource;
|
||||
import io.dataease.plugins.common.base.mapper.DatasetTableFieldMapper;
|
||||
import io.dataease.plugins.common.constants.DeTypeConstants;
|
||||
import io.dataease.plugins.common.constants.ImpalaConstants;
|
||||
import io.dataease.plugins.common.constants.SQLConstants;
|
||||
import io.dataease.plugins.common.constants.SqlServerSQLConstants;
|
||||
import io.dataease.plugins.common.dto.chart.ChartCustomFilterItemDTO;
|
||||
@ -1070,6 +1071,8 @@ public class SqlserverQueryProvider extends QueryProvider {
|
||||
} else if (SQLConstants.DIMENSION_TYPE.contains(y.getDeType())) {
|
||||
if (StringUtils.equalsIgnoreCase(y.getSummary(), "count_distinct")) {
|
||||
fieldName = String.format(SqlServerSQLConstants.AGG_FIELD, "COUNT", "DISTINCT " + originField);
|
||||
} else if (StringUtils.equalsIgnoreCase(y.getSummary(), "group_concat")) {
|
||||
fieldName = String.format(SqlServerSQLConstants.GROUP_CONCAT, originField);
|
||||
} else {
|
||||
fieldName = String.format(SqlServerSQLConstants.AGG_FIELD, y.getSummary(), originField);
|
||||
}
|
||||
|
@ -4,6 +4,7 @@ import cn.hutool.core.util.ReflectUtil;
|
||||
import com.google.gson.Gson;
|
||||
import io.dataease.dto.dataset.DataSetTableUnionDTO;
|
||||
import io.dataease.dto.dataset.DataTableInfoDTO;
|
||||
import io.dataease.plugins.common.base.domain.ChartViewWithBLOBs;
|
||||
import io.dataease.plugins.common.base.domain.DatasetTableField;
|
||||
import io.dataease.plugins.common.base.domain.Datasource;
|
||||
import io.dataease.plugins.common.constants.SQLConstants;
|
||||
@ -225,4 +226,17 @@ public class ViewPluginBaseServiceImpl implements ViewPluginBaseService {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String sqlLimit(String dsType, String sql, PluginViewLimit pluginViewLimit) {
|
||||
QueryProvider queryProvider = ProviderFactory.getQueryProvider(dsType);
|
||||
String methodName = "sqlLimit";
|
||||
ChartViewWithBLOBs chartView = new ChartViewWithBLOBs();
|
||||
chartView.setResultMode(pluginViewLimit.getResultMode());
|
||||
chartView.setResultCount(pluginViewLimit.getResultCount());
|
||||
Object result;
|
||||
if ((result = execProviderMethod(queryProvider, methodName, sql, chartView)) != null) {
|
||||
return result.toString();
|
||||
}
|
||||
return sql;
|
||||
}
|
||||
}
|
||||
|
@ -874,7 +874,13 @@ public class ChartDataBuild {
|
||||
|
||||
// 表格
|
||||
public static Map<String, Object> transTableNormal(Map<String, List<ChartViewFieldDTO>> fieldMap, ChartViewWithBLOBs view, List<String[]> data, List<String> desensitizationList) {
|
||||
List<ChartViewFieldDTO> fields = fieldMap.entrySet().stream().map(Map.Entry::getValue).flatMap(List::stream).collect(Collectors.toList());
|
||||
// List<ChartViewFieldDTO> fields = fieldMap.entrySet().stream().map(Map.Entry::getValue).flatMap(List::stream).collect(Collectors.toList());
|
||||
// 上面乱序了
|
||||
List<ChartViewFieldDTO> fields = new ArrayList<>();
|
||||
if (CollectionUtils.isNotEmpty(fieldMap.get("xAxis")))fields.addAll(fieldMap.get("xAxis"));
|
||||
if (CollectionUtils.isNotEmpty(fieldMap.get("yAxis")))fields.addAll(fieldMap.get("yAxis"));
|
||||
if (CollectionUtils.isNotEmpty(fieldMap.get("labelAxis")))fields.addAll(fieldMap.get("labelAxis"));
|
||||
if (CollectionUtils.isNotEmpty(fieldMap.get("tooltipAxis")))fields.addAll(fieldMap.get("tooltipAxis"));
|
||||
return transTableNormal(fields, view, data, desensitizationList);
|
||||
}
|
||||
|
||||
@ -888,7 +894,7 @@ public class ChartDataBuild {
|
||||
d.put(fields.get(i).getDataeaseName(), ColumnPermissionConstants.Desensitization_desc);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (i == ele.length) break;
|
||||
ChartViewFieldDTO chartViewFieldDTO = fields.get(i);
|
||||
if (chartViewFieldDTO.getDeType() == 0 || chartViewFieldDTO.getDeType() == 1 || chartViewFieldDTO.getDeType() == 5) {
|
||||
d.put(fields.get(i).getDataeaseName(), StringUtils.isEmpty(ele[i]) ? "" : ele[i]);
|
||||
|
@ -76,7 +76,7 @@ public class DirectFieldService implements DataSetFieldService {
|
||||
fields = permissionService.filterColumnPermissons(fields, desensitizationList, datasetTable.getId(), userId);
|
||||
Map<String, DatasetTableField> fieldMap = fields.stream().collect(Collectors.toMap(DatasetTableField::getId, node -> node));
|
||||
permissionFields = fieldIds.stream().map(fieldMap::get).collect(Collectors.toList());
|
||||
if (CollectionUtils.isEmpty(permissionFields)) {
|
||||
if (CollectionUtils.isEmpty(permissionFields) || permissionFields.get(0) == null) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(desensitizationList) && desensitizationList.contains(field.getDataeaseName())) {
|
||||
|
Loading…
Reference in New Issue
Block a user