package com.cloud.model.common;
|
|
import com.cloud.model.sys.AppUser;
|
import lombok.Data;
|
|
import java.util.Date;
|
|
/**
|
* @param <T>
|
* @author bsk
|
* @date 2018-05-05
|
*/
|
@Data
|
public abstract class BaseDataEntity<T> extends BaseEntity<T> {
|
|
private static final long serialVersionUID = 1L;
|
|
/**
|
* 创建者
|
*/
|
protected String createBy;
|
/**
|
* 创建日期
|
*/
|
protected Date createTime;
|
/**
|
* 更新者
|
*/
|
protected String updateBy;
|
/**
|
* 更新日期
|
*/
|
protected Date updateTime;
|
/**
|
* 删除标记(0:正常;1:删除;2:审核)
|
*/
|
protected String delFlag;
|
|
|
/**
|
* 插入之前执行方法,需要手动调用
|
*/
|
@Override
|
public void preInsert(AppUser user) {
|
// 不限制ID为UUID,调用setIsNewRecord()使用自定义ID
|
if (user == null){
|
throw new java.lang.SecurityException ("this process no authority"); // wp 添加 2018-12-04
|
}
|
this.updateBy = user.getUsername();
|
this.createBy = user.getUsername();
|
|
this.createTime = new Date();
|
this.updateTime = this.getCreateTime();
|
|
this.delFlag = DEL_FLAG_NORMAL;
|
}
|
|
/**
|
* 更新之前执行方法,需要手动调用
|
*/
|
@Override
|
public void preUpdate(AppUser user) {
|
if (user == null){
|
throw new java.lang.SecurityException ("this process no authority"); // wp 添加 2018-12-04
|
}
|
this.updateBy = user.getUsername();
|
this.updateTime = new Date();
|
}
|
|
|
}
|