RBAC模型

This commit is contained in:
myh 2023-11-05 23:25:27 +08:00
parent 56fdd7db34
commit b7432cc0c5
5 changed files with 92 additions and 0 deletions

View File

@ -0,0 +1,17 @@
package com.example.springdemo.entities.RBAC;
import jakarta.persistence.*;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@NoArgsConstructor
@Entity
@Table(name = "Permissions")
public class Permissions {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer id;//主键权限ID
@Column(name = "description")
private String description;//权限名称
}

View File

@ -0,0 +1,16 @@
package com.example.springdemo.entities.RBAC;
import jakarta.persistence.*;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@NoArgsConstructor
@Entity
@Table(name = "Roles")
public class Roles {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer id;//主键角色ID
private String name;//角色名称
}

View File

@ -0,0 +1,21 @@
package com.example.springdemo.entities.RBAC;
import jakarta.persistence.*;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@NoArgsConstructor
@Entity
@Table(name = "RolesPermissions")
public class RolesPermissions {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer id;//主键角色权限ID
@OneToOne
@JoinColumn(name = "RolesID", referencedColumnName = "id")
private Roles roles;//角色ID
@OneToOne
@JoinColumn(name = "PermissionsID", referencedColumnName = "id")
private Permissions permissions;//权限ID
}

View File

@ -0,0 +1,19 @@
package com.example.springdemo.entities.password;
import com.example.springdemo.entities.Merchants;
import jakarta.persistence.*;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@NoArgsConstructor
@Entity
@Table(name = "MerchantsPassword")
public class MerchantsPassword {
@Id
@OneToOne
@Column(name = "merchantID")
@JoinColumn(name = "merchantID", referencedColumnName = "id")
private Merchants merchants;
private String password;
}

View File

@ -0,0 +1,19 @@
package com.example.springdemo.entities.password;
import com.example.springdemo.entities.Users;
import jakarta.persistence.*;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@NoArgsConstructor
@Entity
@Table(name = "UsersPassword")
public class UsersPassword {
@Id
@OneToOne
@Column(name = "userID")
@JoinColumn(name = "userID", referencedColumnName = "id")
private Users users;
private String password;
}