fix 修复数据权限 仅自己 相关问题

This commit is contained in:
疯狂的狮子li
2021-12-14 10:11:16 +08:00
parent 2a8a72a085
commit c5dbd04c9c
2 changed files with 14 additions and 8 deletions

View File

@ -23,34 +23,39 @@ public enum DataScopeType {
/**
* 全部数据权限
*/
ALL("1", ""),
ALL("1", "", ""),
/**
* 自定数据权限
*/
CUSTOM("2", " #{#deptName} IN ( #{@sdss.getRoleCustom( #user.roleId )} ) "),
CUSTOM("2", " #{#deptName} IN ( #{@sdss.getRoleCustom( #user.roleId )} ) ", ""),
/**
* 部门数据权限
*/
DEPT("3", " #{#deptName} = #{#user.deptId} "),
DEPT("3", " #{#deptName} = #{#user.deptId} ", ""),
/**
* 部门及以下数据权限
*/
DEPT_AND_CHILD("4", " #{#deptName} IN ( #{@sdss.getDeptAndChild( #user.deptId )} )"),
DEPT_AND_CHILD("4", " #{#deptName} IN ( #{@sdss.getDeptAndChild( #user.deptId )} )", ""),
/**
* 仅本人数据权限
*/
SELF("5", " #{#userName?:1} = #{#user.userId} ");
SELF("5", " #{#userName} = #{#user.userId} " , " 1 = 0 ");
private final String code;
/**
* 语法 采用 spel 模板表达式
*/
private final String sql;
private final String sqlTemplate;
/**
* 不满足 sqlTemplate 则填充
*/
private final String elseSql;
public static DataScopeType findCode(String code) {
if (StringUtils.isBlank(code)) {