mirror of https://gitee.com/y_project/RuoYi.git
新增角色配置本部门及以下数据权限
parent
d1b440fc0d
commit
50515e1aff
|
@ -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…
Reference in New Issue