forked from github/dataease
fix: mysql 时间处理错误
This commit is contained in:
parent
0d7b1f1805
commit
76098ef5c5
@ -117,7 +117,7 @@ public class MysqlQueryProvider extends QueryProvider {
|
|||||||
if (f.getType().equalsIgnoreCase("YEAR")) {
|
if (f.getType().equalsIgnoreCase("YEAR")) {
|
||||||
fieldName = String.format(MySQLConstants.DATE_FORMAT, "CONCAT(" + originField + ",'-01-01')", MySQLConstants.DEFAULT_DATE_FORMAT);
|
fieldName = String.format(MySQLConstants.DATE_FORMAT, "CONCAT(" + originField + ",'-01-01')", MySQLConstants.DEFAULT_DATE_FORMAT);
|
||||||
} else if (f.getType().equalsIgnoreCase("TIME")) {
|
} 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 {
|
} else {
|
||||||
fieldName = String.format(MySQLConstants.DATE_FORMAT, originField, MySQLConstants.DEFAULT_DATE_FORMAT);
|
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")) {
|
if (f.getType().equalsIgnoreCase("YEAR")) {
|
||||||
fieldName = String.format(MySQLConstants.DATE_FORMAT, "CONCAT(" + originField + ",'-01-01')", MySQLConstants.DEFAULT_DATE_FORMAT);
|
fieldName = String.format(MySQLConstants.DATE_FORMAT, "CONCAT(" + originField + ",'-01-01')", MySQLConstants.DEFAULT_DATE_FORMAT);
|
||||||
} else if (f.getType().equalsIgnoreCase("TIME")) {
|
} 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 {
|
} else {
|
||||||
fieldName = String.format(MySQLConstants.DATE_FORMAT, originField, MySQLConstants.DEFAULT_DATE_FORMAT);
|
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")) {
|
if (x.getType().equalsIgnoreCase("YEAR")) {
|
||||||
fieldName = String.format(MySQLConstants.DATE_FORMAT, "CONCAT(" + originField + ",'-01-01')", transDateFormat(x.getDateStyle(), x.getDatePattern()));
|
fieldName = String.format(MySQLConstants.DATE_FORMAT, "CONCAT(" + originField + ",'-01-01')", transDateFormat(x.getDateStyle(), x.getDatePattern()));
|
||||||
} else if (x.getType().equalsIgnoreCase("TIME")) {
|
} 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 {
|
} else {
|
||||||
String format = transDateFormat(x.getDateStyle(), x.getDatePattern());
|
String format = transDateFormat(x.getDateStyle(), x.getDatePattern());
|
||||||
fieldName = String.format(MySQLConstants.DATE_FORMAT, originField, format);
|
fieldName = String.format(MySQLConstants.DATE_FORMAT, originField, format);
|
||||||
|
Loading…
Reference in New Issue
Block a user