1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- package cn.minbb.edu.model;
- import lombok.Getter;
- import lombok.NoArgsConstructor;
- import lombok.Setter;
- import javax.persistence.*;
- import java.io.Serializable;
- @Entity
- @Table(name = "user_role",
- uniqueConstraints = {@UniqueConstraint(name = "unique_name", columnNames = {"name"})},
- indexes = {@Index(name = "index_name", columnList = "name")})
- @NoArgsConstructor
- public class UserRole implements Serializable {
- @Getter
- @Setter
- @Id
- @GeneratedValue(strategy = GenerationType.IDENTITY)
- @Column(name = "id", nullable = false, columnDefinition = "INT COMMENT '用户角色'")
- private Integer id;
- @Getter
- @Setter
- @Column(name = "name", nullable = false, columnDefinition = "VARCHAR(32) COMMENT '角色名称'")
- private String name;
- @Getter
- @Setter
- @Column(name = "description", columnDefinition = "VARCHAR(255) COMMENT '角色描述'")
- private String description;
- public UserRole(String name) {
- this.name = name;
- }
- public UserRole(String name, String description) {
- this.name = name;
- this.description = description;
- }
- @Getter
- public enum Role {
- USER("用户"),
- STUDENT("学生"),
- TEACHER("教师"),
- ADMIN("管理员");
- String description;
- Role(String description) {
- this.description = description;
- }
- }
- }
|