Merge pull request #3191 from dataease/pr@dev@excel

Pr@dev@excel
This commit is contained in:
xuwei-fit2cloud
2022-09-27 10:20:48 +08:00
committed by GitHub
5 changed files with 69 additions and 70 deletions

View File

@@ -114,9 +114,11 @@ public class MysqlQueryProvider extends QueryProvider {
if (f.getDeType() == 2 || f.getDeType() == 3) {
fieldName = String.format(MySQLConstants.UNIX_TIMESTAMP, originField) + "*1000";
} else {
if(f.getType().equalsIgnoreCase("YEAR")){
if (f.getType().equalsIgnoreCase("YEAR")) {
fieldName = String.format(MySQLConstants.DATE_FORMAT, "CONCAT(" + originField + ",'-01-01')", MySQLConstants.DEFAULT_DATE_FORMAT);
}else {
} else if (f.getType().equalsIgnoreCase("TIME")) {
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);
}
}
@@ -171,9 +173,11 @@ public class MysqlQueryProvider extends QueryProvider {
if (f.getDeType() == 2 || f.getDeType() == 3) {
fieldName = String.format(MySQLConstants.UNIX_TIMESTAMP, originField) + "*1000";
} else {
if(f.getType().equalsIgnoreCase("YEAR")){
if (f.getType().equalsIgnoreCase("YEAR")) {
fieldName = String.format(MySQLConstants.DATE_FORMAT, "CONCAT(" + originField + ",'-01-01')", MySQLConstants.DEFAULT_DATE_FORMAT);
}else {
} else if (f.getType().equalsIgnoreCase("TIME")) {
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);
}
}
@@ -1133,9 +1137,11 @@ public class MysqlQueryProvider extends QueryProvider {
if (x.getDeType() == 2 || x.getDeType() == 3) {
fieldName = String.format(MySQLConstants.UNIX_TIMESTAMP, originField) + "*1000";
} else if (x.getDeType() == 1) {
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()));
}else {
} else if (x.getType().equalsIgnoreCase("TIME")) {
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);
}