From 526c3867b412698f8ab08f2568a81e95010b462b Mon Sep 17 00:00:00 2001 From: RuoYi Date: Tue, 21 Apr 2020 17:13:02 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E7=94=9F=E6=88=90Date?= =?UTF-8?q?=E5=AD=97=E6=AE=B5=E6=B7=BB=E5=8A=A0=E9=BB=98=E8=AE=A4=E6=A0=BC?= =?UTF-8?q?=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/ruoyi/project/tool/gen/util/VelocityUtils.java | 1 + ruoyi/src/main/resources/vm/java/domain.java.vm | 7 ++++--- ruoyi/src/main/resources/vm/vue/index-tree.vue.vm | 2 +- ruoyi/src/main/resources/vm/vue/index.vue.vm | 2 +- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/ruoyi/src/main/java/com/ruoyi/project/tool/gen/util/VelocityUtils.java b/ruoyi/src/main/java/com/ruoyi/project/tool/gen/util/VelocityUtils.java index 3b5b02c9..f3e38a87 100644 --- a/ruoyi/src/main/java/com/ruoyi/project/tool/gen/util/VelocityUtils.java +++ b/ruoyi/src/main/java/com/ruoyi/project/tool/gen/util/VelocityUtils.java @@ -196,6 +196,7 @@ public class VelocityUtils if (!column.isSuperColumn() && GenConstants.TYPE_DATE.equals(column.getJavaType())) { importList.add("java.util.Date"); + importList.add("com.fasterxml.jackson.annotation.JsonFormat"); } else if (!column.isSuperColumn() && GenConstants.TYPE_BIGDECIMAL.equals(column.getJavaType())) { diff --git a/ruoyi/src/main/resources/vm/java/domain.java.vm b/ruoyi/src/main/resources/vm/java/domain.java.vm index e99ef2cf..c943c1b2 100644 --- a/ruoyi/src/main/resources/vm/java/domain.java.vm +++ b/ruoyi/src/main/resources/vm/java/domain.java.vm @@ -1,5 +1,8 @@ package ${packageName}.domain; +#foreach ($import in $importList) +import ${import}; +#end import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringStyle; import com.ruoyi.framework.aspectj.lang.annotation.Excel; @@ -8,9 +11,6 @@ import com.ruoyi.framework.web.domain.BaseEntity; #elseif($table.tree) import com.ruoyi.framework.web.domain.TreeEntity; #end -#foreach ($import in $importList) -import ${import}; -#end /** * ${functionName}对象 ${tableName} @@ -40,6 +40,7 @@ public class ${ClassName} extends ${Entity} #if($parentheseIndex != -1) @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()") #elseif($column.javaType == 'Date') + @JsonFormat(pattern = "yyyy-MM-dd") @Excel(name = "${comment}", width = 30, dateFormat = "yyyy-MM-dd") #else @Excel(name = "${comment}") diff --git a/ruoyi/src/main/resources/vm/vue/index-tree.vue.vm b/ruoyi/src/main/resources/vm/vue/index-tree.vue.vm index 0cbdd3b0..a578e89a 100644 --- a/ruoyi/src/main/resources/vm/vue/index-tree.vue.vm +++ b/ruoyi/src/main/resources/vm/vue/index-tree.vue.vm @@ -88,7 +88,7 @@ #elseif($column.list && $column.htmlType == "datetime") #elseif($column.list && "" != $column.dictType) diff --git a/ruoyi/src/main/resources/vm/vue/index.vue.vm b/ruoyi/src/main/resources/vm/vue/index.vue.vm index 8d89857d..12022ca5 100644 --- a/ruoyi/src/main/resources/vm/vue/index.vue.vm +++ b/ruoyi/src/main/resources/vm/vue/index.vue.vm @@ -112,7 +112,7 @@ #elseif($column.list && $column.htmlType == "datetime") #elseif($column.list && "" != $column.dictType)