Browse Source

总体统计图返回key修改

chenw 6 years ago
parent
commit
10479cbc62

+ 7 - 7
bi-server/src/main/java/com/usoftchina/bi/server/service/chart/ShowPopulationService.java

@@ -114,7 +114,7 @@ public class ShowPopulationService {
         }else {
             String listOne = groupByList.get(0);
 
-            Iterator operatorsList = operators.iterator();
+            Iterator<String> operatorsList = operators.iterator();
             //获取常规运算列
             List<String> operatorColumn = new ArrayList<>();
             //获取25th,75th算符
@@ -122,16 +122,16 @@ public class ShowPopulationService {
 
             String next = null;
             while (operatorsList.hasNext()){
-                next = String.valueOf(operatorsList.next()).toLowerCase();
+                next = operatorsList.next();
 
                 //计算25th,75th,和百分比
-                if (next.toUpperCase() == "PERCENT" || "PERCENT".equals(next.toUpperCase())){
-                    String op = "count(" + columnName + ")/(select count(1) from " + tableName + ") "+ next;
+                if ("PERCENT".equalsIgnoreCase(next)){
+                    String op = "count(" + columnName + ")/(select count(1) from " + tableName + ") \""+ next + "\"";
                     operatorColumn.add(op);
-                }else if ("25th".equals(next) || "75th".equals(next)){
-                    operatorOther.add(next);
+                }else if ("25th".equalsIgnoreCase(next) || "75th".equalsIgnoreCase(next)){
+                    operatorOther.add("\"" + next + "\"");
                 }else {
-                    String op = next + "(" + columnName + ") as " + next.toLowerCase();
+                    String op = next + "(" + columnName + ") as \"" + next + "\"";
                     operatorColumn.add(op);
                 }
             }