| | |
| | | |
| | | import com.project.common.annotation.DataScope; |
| | | import com.project.common.core.domain.BaseEntity; |
| | | import com.project.common.core.domain.BaseQuery; |
| | | import com.project.common.core.domain.entity.SysRole; |
| | | import com.project.common.core.domain.entity.SysUser; |
| | | import com.project.common.core.domain.model.LoginUser; |
| | |
| | | } |
| | | else if (DATA_SCOPE_DEPT.equals(dataScope)) |
| | | { |
| | | sqlString.append(StringUtils.format(" OR {}.dept_id = {} ", deptAlias, user.getDeptId())); |
| | | sqlString.append(StringUtils.format(" OR {} = {} ", deptAlias, user.getDeptId())); |
| | | } |
| | | else if (DATA_SCOPE_DEPT_AND_CHILD.equals(dataScope)) |
| | | { |
| | | sqlString.append(StringUtils.format( |
| | | " OR {} IN ( SELECT dept_id FROM sys_dept WHERE dept_id = {} or find_in_set( {} , ancestors ) )", |
| | | deptAlias, user.getDeptId(), user.getDeptId())); |
| | | } |
| | | else if (DATA_SCOPE_ORG.equals(dataScope)) |
| | | { |
| | | sqlString.append(StringUtils.format( |
| | | " OR {} IN ( SELECT dept_id FROM sys_dept WHERE dept_id = {} or find_in_set( {} , ancestors ) )", |
| | | deptAlias, user.getRecommendUser(), user.getRecommendUser())); |
| | | } |
| | | else if (DATA_SCOPE_SELF.equals(dataScope)) |
| | | { |
| | |
| | | if (StringUtils.isNotNull(params) && params instanceof BaseEntity) |
| | | { |
| | | BaseEntity baseEntity = (BaseEntity) params; |
| | | baseEntity.getParams().put(DATA_SCOPE, " AND (" + sqlString.substring(4) + ")"); |
| | | baseEntity.getParams().put(DATA_SCOPE, " (" + sqlString.substring(4) + ")"); |
| | | } else if (StringUtils.isNotNull(params) && params instanceof BaseQuery) { |
| | | BaseQuery baseQuery = (BaseQuery) params; |
| | | baseQuery.getParams().put(DATA_SCOPE, " (" + sqlString.substring(4) + ")"); |
| | | } |
| | | } |
| | | } |