package com.xunhong.erp.turbo.datasource.domain.entity;

import com.baomidou.mybatisplus.annotation.*;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import lombok.Getter;
import lombok.Setter;

import java.time.LocalDateTime;

/**
 * @author shenyifei
 */
@Setter
@Getter
public abstract class BaseDO<T extends Model<?>> extends Model<T> {

	/**
	 * 创建时间
	 */
	@TableField(value = "created_at", fill = FieldFill.INSERT, updateStrategy = FieldStrategy.NEVER)
	protected LocalDateTime createdAt;
	/**
	 * 更新时间
	 */
	@TableField(value = "updated_at", fill = FieldFill.INSERT_UPDATE)
	protected LocalDateTime updatedAt;
	/**
	 * 逻辑删除时间
	 */
	@TableLogic(value = "0", delval = "1")
	@TableField(value = "is_delete", fill = FieldFill.INSERT)
	protected Integer isDelete;
	/**
	 * 数据版本号(乐观锁)
	 */
	@Version
	@TableField(value = "version", fill = FieldFill.INSERT)
	protected Integer version;
}
