fix: db2 时间格式化

This commit is contained in:
taojinlong 2022-06-28 17:42:05 +08:00
parent 27aa14b6ca
commit 00aeffc8dc

View File

@ -117,6 +117,8 @@ public class Db2QueryProvider extends QueryProvider {
} else {
if (f.getType().equalsIgnoreCase("TIME")) {
fieldName = String.format(Db2Constants.FORMAT_TIME, originField, Db2Constants.DEFAULT_DATE_FORMAT);
} else if(f.getType().equalsIgnoreCase("DATE")) {
fieldName = String.format(Db2Constants.FORMAT_DATE, originField, Db2Constants.DEFAULT_DATE_FORMAT);
}else {
fieldName = originField;
}
@ -194,6 +196,8 @@ public class Db2QueryProvider extends QueryProvider {
} else {
if (f.getType().equalsIgnoreCase("TIME")) {
fieldName = String.format(Db2Constants.FORMAT_TIME, originField, Db2Constants.DEFAULT_DATE_FORMAT);
} else if(f.getType().equalsIgnoreCase("DATE")) {
fieldName = String.format(Db2Constants.FORMAT_DATE, originField, Db2Constants.DEFAULT_DATE_FORMAT);
}else {
fieldName = originField;
}
@ -857,6 +861,8 @@ public class Db2QueryProvider extends QueryProvider {
if (field.getDeExtractType() == DeTypeConstants.DE_TIME) {
if (field.getType().equalsIgnoreCase("TIME")) {
whereName = String.format(Db2Constants.FORMAT_TIME, originName, Db2Constants.DEFAULT_DATE_FORMAT);
}else if(field.getType().equalsIgnoreCase("DATE")) {
whereName = String.format(Db2Constants.FORMAT_DATE, originName, Db2Constants.DEFAULT_DATE_FORMAT);
}else {
whereName = originName;
}
@ -965,6 +971,8 @@ public class Db2QueryProvider extends QueryProvider {
if (field.getDeExtractType() == DeTypeConstants.DE_TIME) {
if (field.getType().equalsIgnoreCase("TIME")) {
whereName = String.format(Db2Constants.FORMAT_TIME, originName, Db2Constants.DEFAULT_DATE_FORMAT);
} else if(field.getType().equalsIgnoreCase("DATE")) {
whereName = String.format(Db2Constants.FORMAT_DATE, originName, Db2Constants.DEFAULT_DATE_FORMAT);
}else {
whereName = originName;
}
@ -1068,6 +1076,8 @@ public class Db2QueryProvider extends QueryProvider {
String format = transDateFormat(x.getDateStyle(), x.getDatePattern());
if (x.getType().equalsIgnoreCase("TIME")) {
fieldName = String.format(Db2Constants.FORMAT_TIME, originField, format);
} else if(x.getType().equalsIgnoreCase("DATE")){
fieldName = String.format(Db2Constants.FORMAT_DATE, originField, format);
}else {
fieldName = String.format(Db2Constants.DATE_FORMAT, originField, format);
}