diff --git a/backend/src/main/java/io/dataease/provider/engine/doris/DorisQueryProvider.java b/backend/src/main/java/io/dataease/provider/engine/doris/DorisQueryProvider.java index d3f0661869..8b9a23b56d 100644 --- a/backend/src/main/java/io/dataease/provider/engine/doris/DorisQueryProvider.java +++ b/backend/src/main/java/io/dataease/provider/engine/doris/DorisQueryProvider.java @@ -125,7 +125,8 @@ public class DorisQueryProvider extends QueryProvider { } else if (f.getDeType() == 3) { fieldName = String.format(DorisConstants.CAST, originField, DorisConstants.DEFAULT_FLOAT_FORMAT); } else if (f.getDeType() == 1) { - fieldName = String.format(DorisConstants.STR_TO_DATE, originField, StringUtils.isNotEmpty(f.getDateFormat()) ? f.getDateFormat() : DorisConstants.DEFAULT_DATE_FORMAT); + fieldName = StringUtils.isEmpty(f.getDateFormat()) ? String.format(DorisConstants.STR_TO_DATE, originField, DorisConstants.DEFAULT_DATE_FORMAT) : + String.format(DorisConstants.DATE_FORMAT, String.format(DorisConstants.STR_TO_DATE, originField, f.getDateFormat()), DorisConstants.DEFAULT_DATE_FORMAT); } else { fieldName = originField; } @@ -201,7 +202,8 @@ public class DorisQueryProvider extends QueryProvider { } else if (f.getDeType() == 3) { fieldName = String.format(DorisConstants.CAST, originField, DorisConstants.DEFAULT_FLOAT_FORMAT); } else if (f.getDeType() == 1) { - fieldName = String.format(DorisConstants.STR_TO_DATE, originField, StringUtils.isNotEmpty(f.getDateFormat()) ? f.getDateFormat() : DorisConstants.DEFAULT_DATE_FORMAT); + fieldName = StringUtils.isEmpty(f.getDateFormat()) ? String.format(DorisConstants.STR_TO_DATE, originField, DorisConstants.DEFAULT_DATE_FORMAT) : + String.format(DorisConstants.DATE_FORMAT, String.format(DorisConstants.STR_TO_DATE, originField, f.getDateFormat()), DorisConstants.DEFAULT_DATE_FORMAT); } else { fieldName = originField; } diff --git a/backend/src/main/java/io/dataease/provider/engine/mysql/MysqlQueryProvider.java b/backend/src/main/java/io/dataease/provider/engine/mysql/MysqlQueryProvider.java index eca6a0bd45..cb426517e4 100644 --- a/backend/src/main/java/io/dataease/provider/engine/mysql/MysqlQueryProvider.java +++ b/backend/src/main/java/io/dataease/provider/engine/mysql/MysqlQueryProvider.java @@ -126,7 +126,8 @@ public class MysqlQueryProvider extends QueryProvider { } else if (f.getDeType() == 3) { fieldName = String.format(MysqlConstants.CAST, originField, MysqlConstants.DEFAULT_FLOAT_FORMAT); } else if (f.getDeType() == 1) { - fieldName = String.format(MysqlConstants.STR_TO_DATE, originField, StringUtils.isNotEmpty(f.getDateFormat()) ? f.getDateFormat() : MysqlConstants.DEFAULT_DATE_FORMAT); + fieldName = StringUtils.isEmpty(f.getDateFormat()) ? String.format(MysqlConstants.STR_TO_DATE, originField, MysqlConstants.DEFAULT_DATE_FORMAT) : + String.format(MysqlConstants.DATE_FORMAT, String.format(MysqlConstants.STR_TO_DATE, originField, f.getDateFormat()), MysqlConstants.DEFAULT_DATE_FORMAT); } else { fieldName = originField; } @@ -201,7 +202,8 @@ public class MysqlQueryProvider extends QueryProvider { } else if (f.getDeType() == 3) { fieldName = String.format(MysqlConstants.CAST, originField, MysqlConstants.DEFAULT_FLOAT_FORMAT); } else if (f.getDeType() == 1) { - fieldName = String.format(MysqlConstants.STR_TO_DATE, originField, StringUtils.isNotEmpty(f.getDateFormat()) ? f.getDateFormat() : MysqlConstants.DEFAULT_DATE_FORMAT); + fieldName = StringUtils.isEmpty(f.getDateFormat()) ? String.format(MysqlConstants.STR_TO_DATE, originField, MysqlConstants.DEFAULT_DATE_FORMAT) : + String.format(MysqlConstants.DATE_FORMAT, String.format(MysqlConstants.STR_TO_DATE, originField, f.getDateFormat()), MysqlConstants.DEFAULT_DATE_FORMAT); } else { fieldName = originField; } @@ -979,9 +981,9 @@ public class MysqlQueryProvider extends QueryProvider { } else { // Doris field type test /*if (field.getDeExtractType() == 2 || field.getDeExtractType() == 3 || field.getDeExtractType() == 4) { - whereValue = String.format(DorisConstants.WHERE_NUMBER_VALUE, value); + whereValue = String.format(MysqlConstants.WHERE_NUMBER_VALUE, value); } else { - whereValue = String.format(DorisConstants.WHERE_VALUE_VALUE, value); + whereValue = String.format(MysqlConstants.WHERE_VALUE_VALUE, value); }*/ whereValue = String.format(MysqlConstants.WHERE_VALUE_VALUE, value); } @@ -1089,9 +1091,9 @@ public class MysqlQueryProvider extends QueryProvider { } else { // doris field type test /*if (field.getDeExtractType() == 2 || field.getDeExtractType() == 3 || field.getDeExtractType() == 4) { - whereValue = String.format(DorisConstants.WHERE_NUMBER_VALUE, value.get(0)); + whereValue = String.format(MysqlConstants.WHERE_NUMBER_VALUE, value.get(0)); } else { - whereValue = String.format(DorisConstants.WHERE_VALUE_VALUE, value.get(0)); + whereValue = String.format(MysqlConstants.WHERE_VALUE_VALUE, value.get(0)); }*/ whereValue = String.format(MysqlConstants.WHERE_VALUE_VALUE, value.get(0)); } diff --git a/backend/src/main/java/io/dataease/provider/query/mysql/MysqlQueryProvider.java b/backend/src/main/java/io/dataease/provider/query/mysql/MysqlQueryProvider.java index 3b39c4f600..de53211f92 100644 --- a/backend/src/main/java/io/dataease/provider/query/mysql/MysqlQueryProvider.java +++ b/backend/src/main/java/io/dataease/provider/query/mysql/MysqlQueryProvider.java @@ -129,7 +129,8 @@ public class MysqlQueryProvider extends QueryProvider { } else if (f.getDeType() == 3) { fieldName = String.format(MySQLConstants.CAST, originField, MySQLConstants.DEFAULT_FLOAT_FORMAT); } else if (f.getDeType() == 1) { - fieldName = String.format(MySQLConstants.STR_TO_DATE, originField, StringUtils.isNotEmpty(f.getDateFormat()) ? f.getDateFormat() : MysqlConstants.DEFAULT_DATE_FORMAT); + fieldName = StringUtils.isEmpty(f.getDateFormat()) ? String.format(MySQLConstants.STR_TO_DATE, originField, MysqlConstants.DEFAULT_DATE_FORMAT) : + String.format(MySQLConstants.DATE_FORMAT, String.format(MySQLConstants.STR_TO_DATE, originField, f.getDateFormat()), MySQLConstants.DEFAULT_DATE_FORMAT); } else { fieldName = originField; } @@ -188,7 +189,8 @@ public class MysqlQueryProvider extends QueryProvider { } else if (f.getDeType() == 3) { fieldName = String.format(MySQLConstants.CAST, originField, MySQLConstants.DEFAULT_FLOAT_FORMAT); } else if (f.getDeType() == 1) { - fieldName = String.format(MySQLConstants.STR_TO_DATE, originField, StringUtils.isNotEmpty(f.getDateFormat()) ? f.getDateFormat() : MysqlConstants.DEFAULT_DATE_FORMAT); + fieldName = StringUtils.isEmpty(f.getDateFormat()) ? String.format(MySQLConstants.STR_TO_DATE, originField, MysqlConstants.DEFAULT_DATE_FORMAT) : + String.format(MySQLConstants.DATE_FORMAT, String.format(MySQLConstants.STR_TO_DATE, originField, f.getDateFormat()), MySQLConstants.DEFAULT_DATE_FORMAT); } else { fieldName = originField; }