| | |
| | | import org.aspectj.lang.JoinPoint; |
| | | import org.aspectj.lang.annotation.Aspect; |
| | | import org.aspectj.lang.annotation.Before; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.stereotype.Component; |
| | | import com.ruoyi.common.annotation.DataScope; |
| | | import com.ruoyi.common.core.domain.BaseEntity; |
| | |
| | | */ |
| | | public static final String DATA_SCOPE = "dataScope"; |
| | | |
| | | |
| | | @Value("${isAdmin}") |
| | | private List<Long> isAdmin; |
| | | |
| | | @Before("@annotation(controllerDataScope)") |
| | | public void doBefore(JoinPoint point, DataScope controllerDataScope) throws Throwable |
| | | { |
| | |
| | | { |
| | | SysUser currentUser = loginUser.getUser(); |
| | | // 如果是超级管理员,则不过滤数据 |
| | | if (StringUtils.isNotNull(currentUser) && !currentUser.isAdmin()) |
| | | if (StringUtils.isNotNull(currentUser) && !isAdmin.contains(loginUser.getUser().getUserId())) |
| | | { |
| | | String permission = StringUtils.defaultIfEmpty(controllerDataScope.permission(), PermissionContextHolder.getContext()); |
| | | dataScopeFilter(joinPoint, currentUser, controllerDataScope.deptAlias(), |