liuxiaolong
2019-05-06 a7bed6b4cfecd61ec153818945f982c5bb796b98
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
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();
    }
 
 
}