mirror of
https://github.com/dataease/dataease.git
synced 2026-05-19 10:18:11 +08:00
feat(视图):视图指标增加数量字段
This commit is contained in:
@@ -256,7 +256,7 @@ public class ChartViewService {
|
||||
|
||||
public String transMysqlSQL(String table, List<ChartViewFieldDTO> xAxis, List<ChartViewFieldDTO> yAxis, List<ChartExtFilterRequest> extFilterRequestList) {
|
||||
// 字段汇总 排序等
|
||||
String[] field = yAxis.stream().map(y -> "CAST(" + y.getSummary() + "(" + y.getOriginName() + ") AS DECIMAL(20,2)) AS _" + y.getSummary() + "_" + y.getOriginName()).toArray(String[]::new);
|
||||
String[] field = yAxis.stream().map(y -> "CAST(" + y.getSummary() + "(" + y.getOriginName() + ") AS DECIMAL(20,2)) AS _" + y.getSummary() + "_" + (StringUtils.equalsIgnoreCase(y.getOriginName(), "*") ? "" : y.getOriginName())).toArray(String[]::new);
|
||||
String[] group = xAxis.stream().map(ChartViewFieldDTO::getOriginName).toArray(String[]::new);
|
||||
String[] order = yAxis.stream().filter(y -> StringUtils.isNotEmpty(y.getSort()) && !StringUtils.equalsIgnoreCase(y.getSort(), "none"))
|
||||
.map(y -> "_" + y.getSummary() + "_" + y.getOriginName() + " " + y.getSort()).toArray(String[]::new);
|
||||
|
||||
@@ -135,6 +135,19 @@ public class DataSetTableService {
|
||||
dimension.add(field);
|
||||
}
|
||||
});
|
||||
// quota add count
|
||||
DatasetTableField count = DatasetTableField.builder()
|
||||
.id("count")
|
||||
.tableId(dataSetTableRequest.getId())
|
||||
.originName("*")
|
||||
.name("记录数*")
|
||||
.type("INT")
|
||||
.checked(true)
|
||||
.columnIndex(999)
|
||||
.deType(2)
|
||||
.build();
|
||||
quota.add(count);
|
||||
|
||||
Map<String, List<DatasetTableField>> map = new HashMap<>();
|
||||
map.put("dimension", dimension);
|
||||
map.put("quota", quota);
|
||||
|
||||
Reference in New Issue
Block a user