新增角色配置本部门及以下数据权限

master
RuoYi 5 years ago committed by Limy
parent f271017e49
commit 3983ca0c05

@ -27,6 +27,7 @@
<option value="1" th:field="*{dataScope}">全部数据权限</option> <option value="1" th:field="*{dataScope}">全部数据权限</option>
<option value="2" th:field="*{dataScope}">自定数据权限</option> <option value="2" th:field="*{dataScope}">自定数据权限</option>
<option value="3" th:field="*{dataScope}">本部门数据权限</option> <option value="3" th:field="*{dataScope}">本部门数据权限</option>
<option value="4" th:field="*{dataScope}">本部门及以下数据权限</option>
</select> </select>
<span class="help-block m-b-none"><i class="fa fa-info-circle"></i> 特殊情况下,设置为“自定数据权限”</span> <span class="help-block m-b-none"><i class="fa fa-info-circle"></i> 特殊情况下,设置为“自定数据权限”</span>
</div> </div>

@ -39,6 +39,11 @@ public class DataScopeAspect
*/ */
public static final String DATA_SCOPE_DEPT = "3"; public static final String DATA_SCOPE_DEPT = "3";
/**
*
*/
public static final String DATA_SCOPE_DEPT_AND_CHILD = "4";
/** /**
* *
*/ */
@ -105,6 +110,12 @@ public class DataScopeAspect
{ {
sqlString.append(StringUtils.format(" OR {}.dept_id = {} ", alias, user.getDeptId())); sqlString.append(StringUtils.format(" OR {}.dept_id = {} ", alias, user.getDeptId()));
} }
else if (DATA_SCOPE_DEPT_AND_CHILD.equals(dataScope))
{
sqlString.append(StringUtils.format(
" OR {}.dept_id IN ( SELECT dept_id FROM sys_dept WHERE dept_id = {} or parent_id= {} )", alias,
user.getDeptId(), user.getDeptId()));
}
} }
if (StringUtils.isNotBlank(sqlString.toString())) if (StringUtils.isNotBlank(sqlString.toString()))

@ -80,7 +80,6 @@ public class GlobalExceptionHandler
public Object businessException(HttpServletRequest request, BusinessException e) public Object businessException(HttpServletRequest request, BusinessException e)
{ {
log.error(e.getMessage(), e); log.error(e.getMessage(), e);
if (ServletUtils.isAjaxRequest(request)) if (ServletUtils.isAjaxRequest(request))
{ {
return AjaxResult.error(e.getMessage()); return AjaxResult.error(e.getMessage());

Loading…
Cancel
Save