优化代码

This commit is contained in:
阿沐 2022-10-25 14:59:11 +08:00
parent bd38ef7146
commit c782464258
4 changed files with 34 additions and 34 deletions

View File

@ -14,13 +14,13 @@ public enum DataScopeEnum {
*/ */
ALL(0), ALL(0),
/** /**
* 部门及子部门数据 * 机构及子机构数据
*/ */
DEPT_AND_CHILD(1), ORG_AND_CHILD(1),
/** /**
* 部门数据 * 机构数据
*/ */
DEPT_ONLY(2), ORG_ONLY(2),
/** /**
* 本人数据 * 本人数据
*/ */

View File

@ -61,15 +61,15 @@ public class SysUserDetailsServiceImpl implements SysUserDetailsService {
if (dataScope.equals(DataScopeEnum.ALL.getValue())) { if (dataScope.equals(DataScopeEnum.ALL.getValue())) {
// 全部数据权限则返回null // 全部数据权限则返回null
return 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()); List<Long> dataScopeList = sysOrgService.getSubOrgIdList(userDetail.getOrgId());
// 自定义数据权限范围 // 自定义数据权限范围
dataScopeList.addAll(sysRoleDataScopeDao.getDataScopeList(userDetail.getId())); dataScopeList.addAll(sysRoleDataScopeDao.getDataScopeList(userDetail.getId()));
return dataScopeList; return dataScopeList;
} else if (dataScope.equals(DataScopeEnum.DEPT_ONLY.getValue())) { } else if (dataScope.equals(DataScopeEnum.ORG_ONLY.getValue())) {
// 部门数据 // 机构数据
List<Long> dataScopeList = new ArrayList<>(); List<Long> dataScopeList = new ArrayList<>();
dataScopeList.add(userDetail.getOrgId()); dataScopeList.add(userDetail.getOrgId());
// 自定义数据权限范围 // 自定义数据权限范围

View File

@ -21,7 +21,7 @@ public class SysRoleDataScopeVO implements Serializable {
@NotNull(message = "角色ID不能为空") @NotNull(message = "角色ID不能为空")
private Long id; private Long id;
@Schema(description = "数据范围 0全部数据 1部门及子部门数据 2本部门数据 3本人数据 4自定义数据") @Schema(description = "数据范围 0全部数据 1机构及子机构数据 2本机构数据 3本人数据 4自定义数据")
@NotNull(message = "数据范围不能为空") @NotNull(message = "数据范围不能为空")
private Integer dataScope; private Integer dataScope;

View File

@ -30,7 +30,7 @@ public class SysRoleVO implements Serializable {
@Schema(description = "备注") @Schema(description = "备注")
private String remark; private String remark;
@Schema(description = "数据范围 0全部数据 1部门及子部门数据 2本部门数据 3本人数据 4自定义数据") @Schema(description = "数据范围 0全部数据 1机构及子机构数据 2本机构数据 3本人数据 4自定义数据")
private Integer dataScope; private Integer dataScope;
@Schema(description = "菜单ID列表") @Schema(description = "菜单ID列表")