소스 검색

增加halfYear

chenw 7 년 전
부모
커밋
6abfabf065
1개의 변경된 파일7개의 추가작업 그리고 5개의 파일을 삭제
  1. 7 5
      bi-server/src/main/java/com/usoftchina/bi/server/service/chart/TimeConverterUtil.java

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

@@ -299,15 +299,17 @@ public class TimeConverterUtil {
     public static String convertToOracleDateStr(String xColumn, String timeType) {
         if ("year".equals(timeType)){
             return "TO_CHAR(" + xColumn + ", 'YYYY')";
-        }else if("month".equals(timeType)) {
+        } else if("month".equals(timeType)) {
             return "TO_CHAR(" + xColumn + ", 'YYYY-MM')";
-        }else if ("day".equals(timeType)) {
+        } else if ("day".equals(timeType)) {
             return "TO_CHAR(" + xColumn + ", 'YYYY-MM-DD')";
-        }else if ("quarter".equals(timeType)) {
+        } else if ("quarter".equals(timeType)) {
             return "TO_CHAR(" + xColumn + ", 'YYYY-Q')";
-        }else if ("week".equals(timeType)) {
+        } else if ("week".equals(timeType)) {
             return "TO_CHAR(" + xColumn + ", 'YYYY-WW')";
-        }else {
+        } else if ("halfYear".equals(timeType)){
+            return "case when to_char(${xAxisName},'MM')<=6 then to_char(${xAxisName},'YYYY')|| '-H1' else to_char(${xAxisName},'YYYY')||'-H2' end ";
+        } else {
             return "TO_CHAR(" + xColumn + ", 'YYYY-MM-DD')";
         }
     }