package com.competition.common.entity; import com.baomidou.mybatisplus.annotation.*; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; import java.io.Serializable; import java.time.LocalDateTime; /** * 基础实体类,所有实体继承此类 * 包含新审计字段(Java规范)和旧审计字段(过渡期兼容) */ @Data @Schema(description = "基础实体") public abstract class BaseEntity implements Serializable { /** 主键 ID(自增) */ @Schema(description = "主键ID") @TableId(type = IdType.AUTO) private Long id; // ====== 新审计字段(Java 规范) ====== /** 创建人账号 */ @Schema(description = "创建人账号") @TableField(value = "create_by", fill = FieldFill.INSERT) private String createBy; /** 更新人账号 */ @Schema(description = "更新人账号") @TableField(value = "update_by", fill = FieldFill.INSERT_UPDATE) private String updateBy; /** 逻辑删除标识(0-未删除,1-已删除) */ @Schema(description = "逻辑删除标识:0-未删除,1-已删除") @TableLogic @TableField(value = "deleted", fill = FieldFill.INSERT) private Integer deleted; // ====== 旧审计字段(过渡期保留,请使用 createBy/updateBy) ====== /** 创建人 ID(已弃用,请使用 createBy) */ @Deprecated @Schema(description = "创建人ID(已弃用,请使用 createBy)") @TableField(value = "creator", fill = FieldFill.INSERT) private Integer creator; /** 修改人 ID(已弃用,请使用 updateBy) */ @Deprecated @Schema(description = "修改人ID(已弃用,请使用 updateBy)") @TableField(value = "modifier", fill = FieldFill.INSERT_UPDATE) private Integer modifier; /** 创建时间 */ @Schema(description = "创建时间") @TableField(value = "create_time", fill = FieldFill.INSERT) private LocalDateTime createTime; /** 修改时间 */ @Schema(description = "修改时间") @TableField(value = "modify_time", fill = FieldFill.INSERT_UPDATE) private LocalDateTime modifyTime; /** 有效状态:1-有效,2-失效 */ @Schema(description = "有效状态:1-有效,2-失效") @TableField(value = "valid_state", fill = FieldFill.INSERT) private Integer validState; }