package com.rf.psychological.base.model;


import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import org.hibernate.annotations.GenericGenerator;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import javax.persistence.*;
import javax.validation.constraints.NotNull;
import java.io.Serializable;

/**
 * @author zzf
 * @description:
 * @date 2021/1/18 19:13
 */
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
@EntityListeners({AuditingEntityListener.class})
@MappedSuperclass
public class BaseEntity implements Serializable {
    @Getter
    @Id
    @GenericGenerator(name = "jpa-uuid", strategy = "uuid")
    @GeneratedValue(generator = "jpa-uuid")
    @Column(name = "id", columnDefinition = "varchar(36) COMMENT '数据ID'")
    @NotNull(groups = Update.class)
    private String id;

    public @interface Update {
    }
}
