refactor(entity): 将 createTime 和 updateTime 字段类型从 Timestamp 改为 Date
- 在 MyEntity 和 MyLogicEntity 类中,将 createTime 和 updateTime 字段的类型从 Timestamp 改为 Date - 这个改动可以简化时间处理逻辑,因为 Date 类型更容易使用和理解 - 保留了原有的 JSONField 和 DateTimeFormat 注解,以确保序列化和反序列化的一致性
This commit is contained in:
@@ -11,6 +11,7 @@ import org.apache.commons.lang3.builder.ToStringBuilder;
|
|||||||
import org.springframework.data.annotation.CreatedBy;
|
import org.springframework.data.annotation.CreatedBy;
|
||||||
import org.springframework.data.annotation.LastModifiedBy;
|
import org.springframework.data.annotation.LastModifiedBy;
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
|
import java.sql.Date;
|
||||||
import java.sql.Timestamp;
|
import java.sql.Timestamp;
|
||||||
|
|
||||||
|
|
||||||
@@ -32,12 +33,12 @@ public class MyEntity extends MyObject {
|
|||||||
@TableField(fill = FieldFill.INSERT)
|
@TableField(fill = FieldFill.INSERT)
|
||||||
@ApiModelProperty(value = "创建时间: yyyy-MM-dd HH:mm:ss", hidden = true)
|
@ApiModelProperty(value = "创建时间: yyyy-MM-dd HH:mm:ss", hidden = true)
|
||||||
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
|
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
|
||||||
private Timestamp createTime;
|
private Date createTime;
|
||||||
|
|
||||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||||
@ApiModelProperty(value = "更新时间: yyyy-MM-dd HH:mm:ss", hidden = true)
|
@ApiModelProperty(value = "更新时间: yyyy-MM-dd HH:mm:ss", hidden = true)
|
||||||
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
|
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
|
||||||
private Timestamp updateTime;
|
private Date updateTime;
|
||||||
|
|
||||||
/* 分组校验 */
|
/* 分组校验 */
|
||||||
public @interface Create {
|
public @interface Create {
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import org.springframework.data.annotation.CreatedBy;
|
|||||||
import org.springframework.data.annotation.LastModifiedBy;
|
import org.springframework.data.annotation.LastModifiedBy;
|
||||||
import org.springframework.format.annotation.DateTimeFormat;
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
|
import java.sql.Date;
|
||||||
import java.sql.Timestamp;
|
import java.sql.Timestamp;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -35,12 +36,12 @@ public class MyLogicEntity extends MyObject {
|
|||||||
@ApiModelProperty(value = "创建时间", hidden = true)
|
@ApiModelProperty(value = "创建时间", hidden = true)
|
||||||
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
|
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
|
||||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
private Timestamp createTime;
|
private Date createTime;
|
||||||
@TableField(value = "update_time", fill = FieldFill.INSERT_UPDATE)
|
@TableField(value = "update_time", fill = FieldFill.INSERT_UPDATE)
|
||||||
@ApiModelProperty(value = "更新时间", hidden = true)
|
@ApiModelProperty(value = "更新时间", hidden = true)
|
||||||
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
|
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
|
||||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
private Timestamp updateTime;
|
private Date updateTime;
|
||||||
@ApiModelProperty(value = "数据有效性", hidden = true)
|
@ApiModelProperty(value = "数据有效性", hidden = true)
|
||||||
@TableLogic
|
@TableLogic
|
||||||
@TableField("available")
|
@TableField("available")
|
||||||
|
|||||||
Reference in New Issue
Block a user