RBAC相关实体

This commit is contained in:
myh 2023-11-06 18:40:08 +08:00
parent c53eeeef38
commit b9b46d4169
3 changed files with 11 additions and 9 deletions

View File

@ -11,7 +11,7 @@ import lombok.NoArgsConstructor;
public class Permissions {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer id;//主键权限ID
private Long id;//主键权限ID
@Column(name = "description")
private String description;//权限名称
@Column(name = "url")

View File

@ -11,6 +11,6 @@ import lombok.NoArgsConstructor;
public class Roles {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer id;//主键角色ID
private Long id;//主键角色ID
private String name;//角色名称
}

View File

@ -4,6 +4,8 @@ import jakarta.persistence.*;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.List;
@Data
@NoArgsConstructor
@Entity
@ -11,11 +13,11 @@ import lombok.NoArgsConstructor;
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
private Long id;//主键
@OneToMany(targetEntity = Roles.class, cascade = CascadeType.ALL, fetch = FetchType.LAZY)
@Column(name = "RolesID")
private List<Roles> roles;//角色ID
@OneToMany(targetEntity = Permissions.class, cascade = CascadeType.ALL, fetch = FetchType.LAZY)
@Column(name = "PermissionsID")
private List<Permissions> permissions;//权限ID
}