| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- package nju.seec.helper.entity;
- import lombok.Data;
- import lombok.experimental.Accessors;
- import nju.seec.helper.enums.UserRole;
- import org.hibernate.annotations.CacheConcurrencyStrategy;
- import org.hibernate.annotations.CreationTimestamp;
- import org.hibernate.annotations.DynamicInsert;
- import org.hibernate.annotations.DynamicUpdate;
- import javax.persistence.*;
- import java.time.LocalDateTime;
- /**
- * @author cst
- */
- @Data
- @Accessors(chain = true)
- @Entity
- @Table(name = "user", uniqueConstraints = {@UniqueConstraint(name = "user_phone_unique", columnNames = "phone"),
- @UniqueConstraint(name = "user_email_unique", columnNames = "email")})
- @DynamicUpdate
- @DynamicInsert
- @Cacheable
- @org.hibernate.annotations.Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
- public class User {
- @Id
- @GeneratedValue(strategy = GenerationType.IDENTITY)
- private Long id;
- @Column(nullable = false)
- private String name;
- @Column(nullable = false)
- private String email;
- @Enumerated(EnumType.STRING)
- @Column(nullable = false, updatable = false)
- private UserRole role;
- @Column(nullable = false)
- private String phone;
- @Column(nullable = false)
- private String password;
- @Column(name = "create_at", updatable = false, nullable = false)
- @CreationTimestamp
- private LocalDateTime createAt;
- // @ColumnDefault("'NORMAL'")
- // @Enumerated(EnumType.STRING)
- // @Column(nullable = false)
- // private UserState state;
- private Long pid;
- }
|