forked from github/dataease
refactor(视图): 下钻后延续第一层排序规则(仅对升降序有效)
This commit is contained in:
parent
c5edb219c6
commit
40357d5382
@ -776,6 +776,8 @@ public class ChartViewService {
|
||||
if (i == drillRequest.size() - 1) {
|
||||
ChartViewFieldDTO nextDrillField = drill.get(i + 1);
|
||||
if (!checkDrillExist(xAxis, extStack, nextDrillField, view)) {
|
||||
// get drill list first element's sort,then assign to nextDrillField
|
||||
nextDrillField.setSort(getDrillSort(xAxis, drill.get(0)));
|
||||
xAxis.add(nextDrillField);
|
||||
}
|
||||
}
|
||||
@ -1533,4 +1535,17 @@ public class ChartViewService {
|
||||
sql = dataSetTableService.removeVariables(sql);
|
||||
return sql;
|
||||
}
|
||||
|
||||
private String getDrillSort(List<ChartViewFieldDTO> xAxis, ChartViewFieldDTO field) {
|
||||
String res = "";
|
||||
for (ChartViewFieldDTO f : xAxis) {
|
||||
if (StringUtils.equalsIgnoreCase(f.getId(), field.getId())) {
|
||||
if (StringUtils.equalsIgnoreCase(f.getSort(), "asc") || StringUtils.equalsIgnoreCase(f.getSort(), "desc")) {
|
||||
res = f.getSort();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user