diff --git a/core/core-backend/src/main/java/io/dataease/engine/constant/SQLConstants.java b/core/core-backend/src/main/java/io/dataease/engine/constant/SQLConstants.java index cf0eab9c81..27396f5246 100644 --- a/core/core-backend/src/main/java/io/dataease/engine/constant/SQLConstants.java +++ b/core/core-backend/src/main/java/io/dataease/engine/constant/SQLConstants.java @@ -49,24 +49,16 @@ public class SQLConstants { public static final String FIELD_DOT = "`%s`"; - public static final String UNIX_TIMESTAMP = "UNIX_TIMESTAMP(%s)"; - - public static final String DATE_FORMAT = "DATE_FORMAT(%s,'%s')"; + public static final String UNIX_TIMESTAMP = "DE_UNIX_TIMESTAMP(%s)"; public static final String DE_DATE_FORMAT = "DE_DATE_FORMAT(%s,'%s')"; - public static final String CAST_DATE_FORMAT = "CAST_DATE_FORMAT(%s,'%s','%s')"; - public static final String DE_CAST_DATE_FORMAT = "DE_CAST_DATE_FORMAT(%s,'%s','%s')"; - public static final String FROM_UNIXTIME = "FROM_UNIXTIME(%s,'%s')"; - - public static final String STR_TO_DATE = "STR_TO_DATE(%s,'%s')"; + public static final String FROM_UNIXTIME = "DE_FROM_UNIXTIME(%s,'%s')"; public static final String DE_STR_TO_DATE = "DE_STR_TO_DATE(%s,'%s')"; - public static final String GET_DATE_FORMAT = "GET_DATE_FORMAT(%s)"; - public static final String CAST = "CAST(%s AS %s)"; public static final String DEFAULT_DATE_FORMAT = "yyyy-MM-dd HH:mm:ss"; diff --git a/core/core-backend/src/main/java/io/dataease/engine/trans/Dimension2SQLObj.java b/core/core-backend/src/main/java/io/dataease/engine/trans/Dimension2SQLObj.java index e98d20cb2f..f213350f1c 100644 --- a/core/core-backend/src/main/java/io/dataease/engine/trans/Dimension2SQLObj.java +++ b/core/core-backend/src/main/java/io/dataease/engine/trans/Dimension2SQLObj.java @@ -67,10 +67,10 @@ public class Dimension2SQLObj { String format = Utils.transDateFormat(x.getDateStyle(), x.getDatePattern()); if (StringUtils.equalsIgnoreCase(x.getDateStyle(), "y_Q")) { fieldName = String.format(format, - String.format(SQLConstants.DATE_FORMAT, originField, "yyyy"), + String.format(SQLConstants.DE_DATE_FORMAT, originField, "yyyy"), String.format(SQLConstants.QUARTER, originField)); } else { - fieldName = String.format(SQLConstants.CAST_DATE_FORMAT, originField, + fieldName = String.format(SQLConstants.DE_CAST_DATE_FORMAT, originField, SQLConstants.DEFAULT_DATE_FORMAT, format); } @@ -94,13 +94,13 @@ public class Dimension2SQLObj { String from_unixtime = String.format(SQLConstants.FROM_UNIXTIME, cast, SQLConstants.DEFAULT_DATE_FORMAT); if (StringUtils.equalsIgnoreCase(x.getDateStyle(), "y_Q")) { fieldName = String.format(format, - String.format(SQLConstants.DATE_FORMAT, from_unixtime, "yyyy"), + String.format(SQLConstants.DE_DATE_FORMAT, from_unixtime, "yyyy"), String.format(SQLConstants.QUARTER, from_unixtime)); } else { - fieldName = String.format(SQLConstants.CAST_DATE_FORMAT, from_unixtime, SQLConstants.DEFAULT_DATE_FORMAT, format); + fieldName = String.format(SQLConstants.DE_CAST_DATE_FORMAT, from_unixtime, SQLConstants.DEFAULT_DATE_FORMAT, format); } } else { - fieldName = String.format(SQLConstants.DATE_FORMAT, originField, format); + fieldName = String.format(SQLConstants.DE_DATE_FORMAT, originField, format); } } else if (Objects.equals(x.getDeType(), DeTypeConstants.DE_STRING) && Objects.equals(x.getDeExtractType(), DeTypeConstants.DE_STRING)) { fieldName = originField; diff --git a/core/core-backend/src/main/java/io/dataease/engine/trans/Order2SQLObj.java b/core/core-backend/src/main/java/io/dataease/engine/trans/Order2SQLObj.java index 53f57b6f54..b1ab44874d 100644 --- a/core/core-backend/src/main/java/io/dataease/engine/trans/Order2SQLObj.java +++ b/core/core-backend/src/main/java/io/dataease/engine/trans/Order2SQLObj.java @@ -61,8 +61,8 @@ public class Order2SQLObj { } else if (Objects.equals(f.getDeType(), DeTypeConstants.DE_FLOAT)) { fieldName = String.format(SQLConstants.CAST, originField, SQLConstants.DEFAULT_FLOAT_FORMAT); } else if (Objects.equals(f.getDeType(), DeTypeConstants.DE_TIME)) { - fieldName = StringUtils.isEmpty(f.getDateFormat()) ? String.format(SQLConstants.STR_TO_DATE, originField, SQLConstants.DEFAULT_DATE_FORMAT) : - String.format(SQLConstants.DATE_FORMAT, String.format(SQLConstants.STR_TO_DATE, originField, f.getDateFormat()), SQLConstants.DEFAULT_DATE_FORMAT); + fieldName = StringUtils.isEmpty(f.getDateFormat()) ? String.format(SQLConstants.DE_STR_TO_DATE, originField, SQLConstants.DEFAULT_DATE_FORMAT) : + String.format(SQLConstants.DE_DATE_FORMAT, String.format(SQLConstants.DE_STR_TO_DATE, originField, f.getDateFormat()), SQLConstants.DEFAULT_DATE_FORMAT); } else { fieldName = originField; }