From 422568bc41704acd48e50d82042100ba106d8695 Mon Sep 17 00:00:00 2001 From: Theo <971366405@qq.com> Date: Mon, 3 Mar 2025 14:38:50 +0800 Subject: [PATCH] =?UTF-8?q?feat(form):=20=E4=B8=BA=20LocalDateTime=20?= =?UTF-8?q?=E7=B1=BB=E5=9E=8B=E7=9A=84=E5=AD=97=E6=AE=B5=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=20JsonFormat=20=E6=B3=A8=E8=A7=A3-=20=E5=9C=A8=E6=A8=A1?= =?UTF-8?q?=E6=9D=BF=E4=B8=AD=E6=B7=BB=E5=8A=A0=E4=BA=86=E5=AF=B9=20LocalD?= =?UTF-8?q?ateTime=20=E7=B1=BB=E5=9E=8B=E5=AD=97=E6=AE=B5=E7=9A=84?= =?UTF-8?q?=E5=A4=84=E7=90=86=20-=E4=B8=BA=20LocalDateTime=20=E5=AD=97?= =?UTF-8?q?=E6=AE=B5=E6=B7=BB=E5=8A=A0=E4=BA=86=20@JsonFormat=20=E6=B3=A8?= =?UTF-8?q?=E8=A7=A3=EF=BC=8C=E7=94=A8=E4=BA=8E=E6=8C=87=E5=AE=9A=E6=97=A5?= =?UTF-8?q?=E6=9C=9F=E6=97=B6=E9=97=B4=E6=A0=BC=E5=BC=8F=20-=20=E8=AE=BE?= =?UTF-8?q?=E7=BD=AE=20timezone=20=E4=B8=BA=20GMT+8=EF=BC=8Cpattern=20?= =?UTF-8?q?=E4=B8=BA=20yyyy-MM-dd=20HH:mm:ss?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/resources/templates/codegen/form.java.vm | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/resources/templates/codegen/form.java.vm b/src/main/resources/templates/codegen/form.java.vm index e2c07377..f05ce6b8 100644 --- a/src/main/resources/templates/codegen/form.java.vm +++ b/src/main/resources/templates/codegen/form.java.vm @@ -7,6 +7,7 @@ import lombok.Getter; import lombok.Setter; #if(${hasLocalDateTime}) import java.time.LocalDateTime; +import com.fasterxml.jackson.annotation.JsonFormat; #end #if(${hasBigDecimal}) import java.math.BigDecimal; @@ -46,6 +47,9 @@ public class ${entityName}Form implements Serializable { #if($fieldConfig.maxLength) @Size(max=$fieldConfig.maxLength, message="$fieldConfig.fieldComment长度不能超过${fieldConfig.maxLength}个字符") #end + #if($fieldConfig.fieldType == 'LocalDateTime') + @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss") + #end private ${fieldConfig.fieldType} ${fieldConfig.fieldName}; #end