优化代码
This commit is contained in:
parent
bd38ef7146
commit
c782464258
|
@ -14,13 +14,13 @@ public enum DataScopeEnum {
|
|||
*/
|
||||
ALL(0),
|
||||
/**
|
||||
* 本部门及子部门数据
|
||||
* 本机构及子机构数据
|
||||
*/
|
||||
DEPT_AND_CHILD(1),
|
||||
ORG_AND_CHILD(1),
|
||||
/**
|
||||
* 本部门数据
|
||||
* 本机构数据
|
||||
*/
|
||||
DEPT_ONLY(2),
|
||||
ORG_ONLY(2),
|
||||
/**
|
||||
* 本人数据
|
||||
*/
|
||||
|
|
|
@ -61,15 +61,15 @@ public class SysUserDetailsServiceImpl implements SysUserDetailsService {
|
|||
if (dataScope.equals(DataScopeEnum.ALL.getValue())) {
|
||||
// 全部数据权限,则返回null
|
||||
return null;
|
||||
} else if (dataScope.equals(DataScopeEnum.DEPT_AND_CHILD.getValue())) {
|
||||
// 本部门及子部门数据
|
||||
} else if (dataScope.equals(DataScopeEnum.ORG_AND_CHILD.getValue())) {
|
||||
// 本机构及子机构数据
|
||||
List<Long> dataScopeList = sysOrgService.getSubOrgIdList(userDetail.getOrgId());
|
||||
// 自定义数据权限范围
|
||||
dataScopeList.addAll(sysRoleDataScopeDao.getDataScopeList(userDetail.getId()));
|
||||
|
||||
return dataScopeList;
|
||||
} else if (dataScope.equals(DataScopeEnum.DEPT_ONLY.getValue())) {
|
||||
// 本部门数据
|
||||
} else if (dataScope.equals(DataScopeEnum.ORG_ONLY.getValue())) {
|
||||
// 本机构数据
|
||||
List<Long> dataScopeList = new ArrayList<>();
|
||||
dataScopeList.add(userDetail.getOrgId());
|
||||
// 自定义数据权限范围
|
||||
|
|
|
@ -15,17 +15,17 @@ import java.util.List;
|
|||
@Data
|
||||
@Schema(description = "角色数据权限")
|
||||
public class SysRoleDataScopeVO implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Schema(description = "id")
|
||||
@NotNull(message = "角色ID不能为空")
|
||||
private Long id;
|
||||
@Schema(description = "id")
|
||||
@NotNull(message = "角色ID不能为空")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "数据范围 0:全部数据 1:本部门及子部门数据 2:本部门数据 3:本人数据 4:自定义数据")
|
||||
@NotNull(message = "数据范围不能为空")
|
||||
private Integer dataScope;
|
||||
@Schema(description = "数据范围 0:全部数据 1:本机构及子机构数据 2:本机构数据 3:本人数据 4:自定义数据")
|
||||
@NotNull(message = "数据范围不能为空")
|
||||
private Integer dataScope;
|
||||
|
||||
@Schema(description = "机构ID列表")
|
||||
private List<Long> orgIdList;
|
||||
@Schema(description = "机构ID列表")
|
||||
private List<Long> orgIdList;
|
||||
|
||||
}
|
|
@ -18,29 +18,29 @@ import java.util.List;
|
|||
@Data
|
||||
@Schema(description = "角色")
|
||||
public class SysRoleVO implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Schema(description = "id")
|
||||
private Long id;
|
||||
@Schema(description = "id")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "角色名称")
|
||||
@NotBlank(message = "角色名称不能为空")
|
||||
private String name;
|
||||
@Schema(description = "角色名称")
|
||||
@NotBlank(message = "角色名称不能为空")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "备注")
|
||||
private String remark;
|
||||
@Schema(description = "备注")
|
||||
private String remark;
|
||||
|
||||
@Schema(description = "数据范围 0:全部数据 1:本部门及子部门数据 2:本部门数据 3:本人数据 4:自定义数据")
|
||||
private Integer dataScope;
|
||||
@Schema(description = "数据范围 0:全部数据 1:本机构及子机构数据 2:本机构数据 3:本人数据 4:自定义数据")
|
||||
private Integer dataScope;
|
||||
|
||||
@Schema(description = "菜单ID列表")
|
||||
private List<Long> menuIdList;
|
||||
@Schema(description = "菜单ID列表")
|
||||
private List<Long> menuIdList;
|
||||
|
||||
@Schema(description = "机构ID列表")
|
||||
private List<Long> orgIdList;
|
||||
@Schema(description = "机构ID列表")
|
||||
private List<Long> orgIdList;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@JsonFormat(pattern = DateUtils.DATE_TIME_PATTERN)
|
||||
private Date createTime;
|
||||
@Schema(description = "创建时间")
|
||||
@JsonFormat(pattern = DateUtils.DATE_TIME_PATTERN)
|
||||
private Date createTime;
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user