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
/* Copyright (c) 2018, yiboshi.com All Rights Reserved. */
package com.yiboshi.science.base;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yiboshi.science.Constants;
import io.swagger.annotations.ApiModelProperty;
import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
import org.hibernate.validator.constraints.Length;
import java.io.Serializable;
import java.util.Date;
/**
* 基础实体对象
*
* @author NEGI
* @version 2018-08
*/
public abstract class BaseEntity implements Serializable {
@ApiModelProperty(value="主键id",hidden = true)
@Length(max=36, message = "Id不能大于36")
/** Id */
@TableId(value="id",type = IdType.UUID )
private String id;
@ApiModelProperty(value = "创建时间", position = 7 )
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
private Date created;
@ApiModelProperty(value="最后修改时间",hidden = true)
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
private Date updated;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public void setCreated(Date created) {
this.created = created;
}
public Date getCreated() {
return created;
}
public void setUpdated(Date updated) {
this.updated = updated;
}
public Date getUpdated() {
return updated;
}
@Override
public String toString() {
return ReflectionToStringBuilder.toStringExclude(this, Constants.excludeFieldNames);
}
}