mirror of https://gitee.com/stylefeng/roses
【8.3.3】【role】角色绑定数据范围,校验机构编码是否存在
parent
2ba0ace8b5
commit
1d916adc64
|
@ -21,7 +21,12 @@ public enum SysRoleDataScopeExceptionEnum implements AbstractExceptionEnum {
|
|||
/**
|
||||
* 存在参数为空,参数名称为:{}
|
||||
*/
|
||||
PARAM_IS_EMPTY(RuleConstants.USER_OPERATION_ERROR_TYPE_CODE + "10002", "存在参数为空,参数名称为:{}");
|
||||
PARAM_IS_EMPTY(RuleConstants.USER_OPERATION_ERROR_TYPE_CODE + "10002", "存在参数为空,参数名称为:{}"),
|
||||
|
||||
/**
|
||||
* 组织机构层级编码不正确
|
||||
*/
|
||||
LEVEL_CODE_IS_ERROR(RuleConstants.USER_OPERATION_ERROR_TYPE_CODE + "10003", "组织机构层级编码不正确");
|
||||
|
||||
/**
|
||||
* 错误编码
|
||||
|
|
|
@ -251,6 +251,19 @@ public class SysRoleDataScopeServiceImpl extends ServiceImpl<SysRoleDataScopeMap
|
|||
if (ObjectUtil.isEmpty(sysRoleDataScopeRequest.getOrgLevelCode())) {
|
||||
throw new SysException(SysRoleDataScopeExceptionEnum.PARAM_IS_EMPTY, "组织机构层级编码orgLevelCode");
|
||||
}
|
||||
|
||||
// 校验机构编码是否真实存在
|
||||
boolean levelCodeOk = false;
|
||||
List<OrganizationLevel> list = orgLevelServiceApi.findList(new OrganizationLevelRequest());
|
||||
for (OrganizationLevel organizationLevel : list) {
|
||||
if (organizationLevel.getLevelCode().equals(sysRoleDataScopeRequest.getOrgLevelCode())) {
|
||||
levelCodeOk = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!levelCodeOk) {
|
||||
throw new SysException(SysRoleDataScopeExceptionEnum.LEVEL_CODE_IS_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
// 如果是新增的是指定机构,则判断机构参数
|
||||
|
|
Loading…
Reference in New Issue