BaseEntity.java
1.2 KB
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
/**
* Copyright (c) 2018 人人开源 All rights reserved.
*
* https://www.renren.io
*
* 版权所有,侵权必究!
*/
package org.yrhl.syncdata.domain;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* 基础实体类,所有实体都需要继承
*
* @author Mark sunlightcs@gmail.com
*/
@Data
public abstract class BaseEntity implements Serializable {
/**
* id
*/
@JsonSerialize(using = ToStringSerializer.class)
@TableId(value = "id", type = IdType.ID_WORKER)
private Long id;
/**
* 创建者
*/
@TableField(fill = FieldFill.INSERT)
@JsonSerialize(using = ToStringSerializer.class)
private Long creator;
/**
* 创建时间
*/
@TableField(fill = FieldFill.INSERT)
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date createDate;
}