From 76098ef5c5cb083c33617168e5962121a37cc67d Mon Sep 17 00:00:00 2001 From: taojinlong Date: Wed, 28 Sep 2022 11:04:02 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20mysql=20=E6=97=B6=E9=97=B4=E5=A4=84?= =?UTF-8?q?=E7=90=86=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dataease/provider/query/mysql/MysqlQueryProvider.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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 5f16332cd1..527bbe3254 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 @@ -117,7 +117,7 @@ public class MysqlQueryProvider extends QueryProvider { if (f.getType().equalsIgnoreCase("YEAR")) { fieldName = String.format(MySQLConstants.DATE_FORMAT, "CONCAT(" + originField + ",'-01-01')", MySQLConstants.DEFAULT_DATE_FORMAT); } else if (f.getType().equalsIgnoreCase("TIME")) { - fieldName = String.format(MySQLConstants.DATE_FORMAT, "CONCAT(1970-01-01 " + originField + ")", MySQLConstants.DEFAULT_DATE_FORMAT); + fieldName = String.format(MySQLConstants.DATE_FORMAT, "CONCAT('1970-01-01', " + originField + ")", MySQLConstants.DEFAULT_DATE_FORMAT); } else { fieldName = String.format(MySQLConstants.DATE_FORMAT, originField, MySQLConstants.DEFAULT_DATE_FORMAT); } @@ -176,7 +176,7 @@ public class MysqlQueryProvider extends QueryProvider { if (f.getType().equalsIgnoreCase("YEAR")) { fieldName = String.format(MySQLConstants.DATE_FORMAT, "CONCAT(" + originField + ",'-01-01')", MySQLConstants.DEFAULT_DATE_FORMAT); } else if (f.getType().equalsIgnoreCase("TIME")) { - fieldName = String.format(MySQLConstants.DATE_FORMAT, "CONCAT(1970-01-01 " + originField + ")", MySQLConstants.DEFAULT_DATE_FORMAT); + fieldName = String.format(MySQLConstants.DATE_FORMAT, "CONCAT('1970-01-01', " + originField + ")", MySQLConstants.DEFAULT_DATE_FORMAT); } else { fieldName = String.format(MySQLConstants.DATE_FORMAT, originField, MySQLConstants.DEFAULT_DATE_FORMAT); } @@ -1140,7 +1140,7 @@ public class MysqlQueryProvider extends QueryProvider { if (x.getType().equalsIgnoreCase("YEAR")) { fieldName = String.format(MySQLConstants.DATE_FORMAT, "CONCAT(" + originField + ",'-01-01')", transDateFormat(x.getDateStyle(), x.getDatePattern())); } else if (x.getType().equalsIgnoreCase("TIME")) { - fieldName = String.format(MySQLConstants.DATE_FORMAT, "CONCAT(1970-01-01 " + originField + ")", MySQLConstants.DEFAULT_DATE_FORMAT); + fieldName = String.format(MySQLConstants.DATE_FORMAT, "CONCAT('1970-01-01', " + originField + ")", MySQLConstants.DEFAULT_DATE_FORMAT); } else { String format = transDateFormat(x.getDateStyle(), x.getDatePattern()); fieldName = String.format(MySQLConstants.DATE_FORMAT, originField, format);