feat(form): 为 LocalDateTime 类型的字段添加 JsonFormat 注解- 在模板中添加了对 LocalDateTime 类型字段的处理

-为 LocalDateTime 字段添加了 @JsonFormat 注解,用于指定日期时间格式
- 设置 timezone 为 GMT+8,pattern 为 yyyy-MM-dd HH:mm:ss
This commit is contained in:
Theo
2025-03-03 14:38:50 +08:00
parent b1e55aae0a
commit 422568bc41

View File

@@ -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