From 40357d53825225d12c7424f5472cad67f40a4209 Mon Sep 17 00:00:00 2001 From: junjun Date: Fri, 8 Jul 2022 15:59:28 +0800 Subject: [PATCH] =?UTF-8?q?refactor(=E8=A7=86=E5=9B=BE):=20=E4=B8=8B?= =?UTF-8?q?=E9=92=BB=E5=90=8E=E5=BB=B6=E7=BB=AD=E7=AC=AC=E4=B8=80=E5=B1=82?= =?UTF-8?q?=E6=8E=92=E5=BA=8F=E8=A7=84=E5=88=99=EF=BC=88=E4=BB=85=E5=AF=B9?= =?UTF-8?q?=E5=8D=87=E9=99=8D=E5=BA=8F=E6=9C=89=E6=95=88=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dataease/service/chart/ChartViewService.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/backend/src/main/java/io/dataease/service/chart/ChartViewService.java b/backend/src/main/java/io/dataease/service/chart/ChartViewService.java index 91bd6a5153..0b654d416b 100644 --- a/backend/src/main/java/io/dataease/service/chart/ChartViewService.java +++ b/backend/src/main/java/io/dataease/service/chart/ChartViewService.java @@ -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 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; + } }