一、持久层通用DO
@Data
public class BaseDO implements Serializable {
@TableId(type = IdType.ASSIGN_ID) // 使用雪花算法的策略生成数据id,默认,注意:当对象的id被明确赋值时,不会使用雪花算法
private Long id;
/**
* 拓展:为什么建议你使用LocalDateTime?
* 1、java.util.Date的大多数方法已经过时
* 2、java.util.Date的输出可读性差
* 3、java.util.Date对应的格式化类SimpleDateFormat是线程不安全的类。阿里巴巴开发手册中禁用static修饰SimpleDateFormat
* 4、LocalDateTime 对应的格式化类DateTimeFormatter是线程安全的
*/
@TableField(fill = FieldFill.INSERT)
private LocalDateTime gmtCreated;
@TableField(fill = FieldFill.INSERT_UPDATE)
private LocalDateTime gmtModified;
@TableLogic
@TableField(value = "is_deleted")
private Integer deleted;
}