权限完善
This commit is contained in:
42
src/main/java/com/dc/dc_project/enums/DataScopeType.java
Normal file
42
src/main/java/com/dc/dc_project/enums/DataScopeType.java
Normal file
@@ -0,0 +1,42 @@
|
||||
package com.dc.dc_project.enums;
|
||||
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
|
||||
/**
|
||||
* 数据权限类型枚举
|
||||
*/
|
||||
@Getter
|
||||
public enum DataScopeType {
|
||||
|
||||
ALL("SELF_ONLY", "仅限用户自己所属组织"),
|
||||
SELF("SELF_AND_DESCENDANTS", "用户自己所属组织及其所有子孙组织"),
|
||||
CUSTOM("ALL_COMPANY ", "全公司所有组织");
|
||||
|
||||
private final String code;
|
||||
private final String desc;
|
||||
|
||||
DataScopeType(String code, String desc) {
|
||||
this.code = code;
|
||||
this.desc = desc;
|
||||
}
|
||||
|
||||
public static DataScopeType getByCode(String code) {
|
||||
for (DataScopeType value : DataScopeType.values()) {
|
||||
if (value.getCode().equals(code)) {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static String getDescByCode(String code) {
|
||||
for (DataScopeType value : DataScopeType.values()) {
|
||||
if (value.getCode().equals(code)) {
|
||||
return value.getDesc();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -33,6 +33,12 @@ public class RolePermission {
|
||||
@TableField(value = "permission_id")
|
||||
private Long permissionId;
|
||||
|
||||
/**
|
||||
* 数据权限范围
|
||||
*/
|
||||
@TableField(value = "data_scope_type")
|
||||
private String dataScopeType;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@@ -45,49 +51,5 @@ public class RolePermission {
|
||||
@TableField(value = "created_by")
|
||||
private String createdBy;
|
||||
|
||||
@Override
|
||||
public boolean equals(Object that) {
|
||||
if (this == that) {
|
||||
return true;
|
||||
}
|
||||
if (that == null) {
|
||||
return false;
|
||||
}
|
||||
if (getClass() != that.getClass()) {
|
||||
return false;
|
||||
}
|
||||
RolePermission other = (RolePermission) that;
|
||||
return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
|
||||
&& (this.getRoleId() == null ? other.getRoleId() == null : this.getRoleId().equals(other.getRoleId()))
|
||||
&& (this.getPermissionId() == null ? other.getPermissionId() == null : this.getPermissionId().equals(other.getPermissionId()))
|
||||
&& (this.getCreatedAt() == null ? other.getCreatedAt() == null : this.getCreatedAt().equals(other.getCreatedAt()))
|
||||
&& (this.getCreatedBy() == null ? other.getCreatedBy() == null : this.getCreatedBy().equals(other.getCreatedBy()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
|
||||
result = prime * result + ((getRoleId() == null) ? 0 : getRoleId().hashCode());
|
||||
result = prime * result + ((getPermissionId() == null) ? 0 : getPermissionId().hashCode());
|
||||
result = prime * result + ((getCreatedAt() == null) ? 0 : getCreatedAt().hashCode());
|
||||
result = prime * result + ((getCreatedBy() == null) ? 0 : getCreatedBy().hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append(getClass().getSimpleName());
|
||||
sb.append(" [");
|
||||
sb.append("Hash = ").append(hashCode());
|
||||
sb.append(", id=").append(id);
|
||||
sb.append(", roleId=").append(roleId);
|
||||
sb.append(", permissionId=").append(permissionId);
|
||||
sb.append(", createdAt=").append(createdAt);
|
||||
sb.append(", createdBy=").append(createdBy);
|
||||
sb.append("]");
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.dc.dc_project.service.impl;
|
||||
|
||||
import cn.dev33.satoken.stp.StpUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
|
||||
Reference in New Issue
Block a user