部门及以下数据权限(调整为以下及所有子节点)

This commit is contained in:
RuoYi
2019-06-05 18:18:25 +08:00
parent 6bc852918e
commit f96aeca790
2 changed files with 4 additions and 3 deletions

View File

@ -112,9 +112,10 @@ public class DataScopeAspect
}
else if (DATA_SCOPE_DEPT_AND_CHILD.equals(dataScope))
{
String deptChild = user.getDept().getParentId() + "," + user.getDeptId();
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()));
" OR {}.dept_id IN ( SELECT dept_id FROM sys_dept WHERE dept_id = {} or ancestors LIKE '%{}%' )",
alias, user.getDeptId(), deptChild));
}
}