forked from github/dataease
fix(数据集): 日期格式化
This commit is contained in:
parent
4d06267df2
commit
73cc64d914
@ -1144,7 +1144,7 @@ public class HiveQueryProvider extends QueryProvider {
|
||||
if (x.getDeType() == DeTypeConstants.DE_TIME) {
|
||||
String format = transDateFormat(x.getDateStyle(), x.getDatePattern());
|
||||
if (x.getDeExtractType() == DeTypeConstants.DE_STRING) {
|
||||
fieldName = String.format(HiveConstants.DATE_FORMAT, originField, format);
|
||||
fieldName = String.format(HiveConstants.DATE_FORMAT, String.format(HiveConstants.STR_TO_DATE, originField, StringUtils.isNotEmpty(x.getDateFormat()) ? x.getDateFormat() : HiveConstants.DEFAULT_DATE_FORMAT), format);
|
||||
} else {
|
||||
String cast = String.format(HiveConstants.CAST, originField, HiveConstants.DEFAULT_INT_FORMAT) + "/1000";
|
||||
String from_unixtime = String.format(HiveConstants.FROM_UNIXTIME, cast, HiveConstants.DEFAULT_DATE_FORMAT);
|
||||
|
@ -1174,7 +1174,7 @@ public class MysqlQueryProvider extends QueryProvider {
|
||||
if (x.getDeType() == 1) {
|
||||
String format = transDateFormat(x.getDateStyle(), x.getDatePattern());
|
||||
if (x.getDeExtractType() == 0) {
|
||||
fieldName = String.format(MySQLConstants.DATE_FORMAT, originField, format);
|
||||
fieldName = String.format(MySQLConstants.DATE_FORMAT, String.format(MySQLConstants.STR_TO_DATE, originField, StringUtils.isNotEmpty(x.getDateFormat()) ? x.getDateFormat() : MysqlConstants.DEFAULT_DATE_FORMAT), format);
|
||||
} else {
|
||||
String cast = String.format(MySQLConstants.CAST, originField, MySQLConstants.DEFAULT_INT_FORMAT) + "/1000";
|
||||
String from_unixtime = String.format(MySQLConstants.FROM_UNIXTIME, cast, MySQLConstants.DEFAULT_DATE_FORMAT);
|
||||
|
@ -964,7 +964,7 @@ public class PgQueryProvider extends QueryProvider {
|
||||
}
|
||||
if (field.getDeType() == 1) {
|
||||
if (field.getDeExtractType() == 0 || field.getDeExtractType() == 5) {
|
||||
whereName = String.format(PgConstants.CAST, originName, "timestamp");
|
||||
whereName = String.format(PgConstants.STR_TO_DATE, originName, StringUtils.isNotEmpty(field.getDateFormat()) ? field.getDateFormat() : PgConstants.DEFAULT_DATE_FORMAT);
|
||||
}
|
||||
if (field.getDeExtractType() == 2 || field.getDeExtractType() == 3 || field.getDeExtractType() == 4) {
|
||||
String cast = String.format(PgConstants.CAST, originName, "bigint");
|
||||
@ -1063,7 +1063,7 @@ public class PgQueryProvider extends QueryProvider {
|
||||
|
||||
if (field.getDeType() == 1) {
|
||||
if (field.getDeExtractType() == 0 || field.getDeExtractType() == 5) {
|
||||
whereName = String.format(PgConstants.CAST, originName, "timestamp");
|
||||
whereName = String.format(PgConstants.STR_TO_DATE, originName, StringUtils.isNotEmpty(field.getDateFormat()) ? field.getDateFormat() : PgConstants.DEFAULT_DATE_FORMAT);
|
||||
}
|
||||
if (field.getDeExtractType() == 2 || field.getDeExtractType() == 3 || field.getDeExtractType() == 4) {
|
||||
String cast = String.format(PgConstants.CAST, originName, "bigint");
|
||||
@ -1177,7 +1177,9 @@ public class PgQueryProvider extends QueryProvider {
|
||||
if (x.getDeType() == DeTypeConstants.DE_TIME) {
|
||||
String format = transDateFormat(x.getDateStyle(), x.getDatePattern());
|
||||
if (x.getDeExtractType() == DeTypeConstants.DE_STRING) {
|
||||
fieldName = String.format(PgConstants.DATE_FORMAT, String.format(PgConstants.CAST, originField, "timestamp"), format);
|
||||
fieldName = String.format(PgConstants.DATE_FORMAT,
|
||||
String.format(PgConstants.STR_TO_DATE, originField, StringUtils.isNotEmpty(x.getDateFormat()) ? x.getDateFormat() : PgConstants.DEFAULT_DATE_FORMAT),
|
||||
format);
|
||||
} else {
|
||||
String cast = String.format(PgConstants.CAST, originField, "bigint");
|
||||
String from_unixtime = String.format(PgConstants.FROM_UNIXTIME, cast);
|
||||
|
@ -963,7 +963,7 @@ public class RedshiftQueryProvider extends QueryProvider {
|
||||
}
|
||||
if (field.getDeType() == 1) {
|
||||
if (field.getDeExtractType() == 0 || field.getDeExtractType() == 5) {
|
||||
whereName = String.format(PgConstants.CAST, originName, "timestamp");
|
||||
whereName = String.format(PgConstants.STR_TO_DATE, originName, StringUtils.isNotEmpty(field.getDateFormat()) ? field.getDateFormat() : PgConstants.DEFAULT_DATE_FORMAT);
|
||||
}
|
||||
if (field.getDeExtractType() == 2 || field.getDeExtractType() == 3 || field.getDeExtractType() == 4) {
|
||||
String cast = String.format(PgConstants.CAST, originName, "bigint");
|
||||
@ -1058,7 +1058,7 @@ public class RedshiftQueryProvider extends QueryProvider {
|
||||
|
||||
if (field.getDeType() == 1) {
|
||||
if (field.getDeExtractType() == 0 || field.getDeExtractType() == 5) {
|
||||
whereName = String.format(PgConstants.CAST, originName, "timestamp");
|
||||
whereName = String.format(PgConstants.STR_TO_DATE, originName, StringUtils.isNotEmpty(field.getDateFormat()) ? field.getDateFormat() : PgConstants.DEFAULT_DATE_FORMAT);
|
||||
}
|
||||
if (field.getDeExtractType() == 2 || field.getDeExtractType() == 3 || field.getDeExtractType() == 4) {
|
||||
String cast = String.format(PgConstants.CAST, originName, "bigint");
|
||||
@ -1166,7 +1166,7 @@ public class RedshiftQueryProvider extends QueryProvider {
|
||||
if (x.getDeType() == DeTypeConstants.DE_TIME) {
|
||||
String format = transDateFormat(x.getDateStyle(), x.getDatePattern());
|
||||
if (x.getDeExtractType() == DeTypeConstants.DE_STRING) {
|
||||
fieldName = String.format(PgConstants.DATE_FORMAT, originField, format);
|
||||
fieldName = String.format(PgConstants.DATE_FORMAT, String.format(PgConstants.STR_TO_DATE, originField, StringUtils.isNotEmpty(x.getDateFormat()) ? x.getDateFormat() : PgConstants.DEFAULT_DATE_FORMAT), format);
|
||||
} else {
|
||||
String cast = String.format(PgConstants.CAST, originField, "bigint");
|
||||
String from_unixtime = String.format(PgConstants.FROM_UNIXTIME, cast);
|
||||
|
@ -52,3 +52,7 @@ where id = '3986ba4c-5a8e-11ed-bc5b-cf4a43b3b40c';
|
||||
|
||||
|
||||
update `my_plugin` set `name` = '气泡地图插件' where `plugin_id` = 2;
|
||||
|
||||
ALTER TABLE `dataset_table_field`
|
||||
CHANGE COLUMN `origin_name` `origin_name` LONGTEXT CHARACTER SET 'utf8mb4' COLLATE 'utf8mb4_bin' NOT NULL ;
|
||||
|
||||
|
@ -872,7 +872,9 @@ export default {
|
||||
item.dateFormat = item.dateFormatType
|
||||
}
|
||||
}
|
||||
|
||||
if(item.dateFormatType === 'custom' && !item.dateFormat){
|
||||
return;
|
||||
}
|
||||
post('/dataset/field/save', item)
|
||||
.then((response) => {
|
||||
this.initField()
|
||||
|
Loading…
Reference in New Issue
Block a user