64 lines
1.4 KiB
Java
64 lines
1.4 KiB
Java
package com.yunhai.userbase.entity;
|
|
|
|
|
|
import javax.persistence.*;
|
|
import javax.validation.constraints.NotNull;
|
|
|
|
import com.yunhai.userbase.common.listener.UserAuditListener;
|
|
import com.yunhai.userbase.common.validation.ValidationGroups;
|
|
import lombok.Getter;
|
|
import lombok.Setter;
|
|
import org.hibernate.annotations.CreationTimestamp;
|
|
import org.hibernate.annotations.UpdateTimestamp;
|
|
|
|
import java.io.Serializable;
|
|
import java.time.LocalDateTime;
|
|
|
|
/**
|
|
* @author chenx
|
|
* @date 2026/7/14 10:46
|
|
* @description
|
|
*/
|
|
|
|
@MappedSuperclass
|
|
@Getter
|
|
@Setter
|
|
@EntityListeners(UserAuditListener.class)
|
|
public abstract class BaseEntity implements Serializable {
|
|
|
|
private static final long serialVersionUID = 1L;
|
|
|
|
@Id
|
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
|
@NotNull(groups = ValidationGroups.Update.class)
|
|
private Integer id;
|
|
|
|
/**
|
|
* 创建人ID
|
|
*/
|
|
@Column(name = "create_user", nullable = false, updatable = false)
|
|
private Integer createUser;
|
|
|
|
/**
|
|
* 创建时间
|
|
*/
|
|
@CreationTimestamp
|
|
@Column(name = "create_time", nullable = false, updatable = false)
|
|
private LocalDateTime createTime;
|
|
|
|
/**
|
|
* 更新人ID
|
|
*/
|
|
@Column(name = "update_user")
|
|
private Integer updateUser;
|
|
|
|
/**
|
|
* 更新时间
|
|
*/
|
|
@UpdateTimestamp
|
|
@Column(name = "update_time")
|
|
private LocalDateTime updateTime;
|
|
|
|
|
|
}
|