com.ruoyi.common.annotation.DataScope Java Examples

The following examples show how to use com.ruoyi.common.annotation.DataScope. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DataScopeAspect.java    From supplierShop with MIT License 6 votes vote down vote up
protected void handleDataScope(final JoinPoint joinPoint)
{
    // 获得注解
    DataScope controllerDataScope = getAnnotationLog(joinPoint);
    if (controllerDataScope == null)
    {
        return;
    }
    // 获取当前的用户
    SysUser currentUser = ShiroUtils.getSysUser();
    if (currentUser != null)
    {
        // 如果是超级管理员,则不过滤数据
        if (!currentUser.isAdmin())
        {
            dataScopeFilter(joinPoint, currentUser, controllerDataScope.deptAlias(),
                    controllerDataScope.userAlias());
        }
    }
}
 
Example #2
Source File: DataScopeAspect.java    From ruoyiplus with MIT License 6 votes vote down vote up
protected void handleDataScope(final JoinPoint joinPoint)
{
    // 获得注解
    DataScope controllerDataScope = getAnnotationLog(joinPoint);
    if (controllerDataScope == null)
    {
        return;
    }
    // 获取当前的用户
    SysUser currentUser = ShiroUtils.getSysUser();
    if (currentUser != null)
    {
        // 如果是超级管理员,则不过滤数据
        if (!currentUser.isAdmin())
        {
            dataScopeFilter(joinPoint, currentUser, controllerDataScope.tableAlias());
        }
    }
}
 
Example #3
Source File: DataScopeAspect.java    From supplierShop with MIT License 5 votes vote down vote up
/**
 * 是否存在注解,如果存在就获取
 */
private DataScope getAnnotationLog(JoinPoint joinPoint)
{
    Signature signature = joinPoint.getSignature();
    MethodSignature methodSignature = (MethodSignature) signature;
    Method method = methodSignature.getMethod();

    if (method != null)
    {
        return method.getAnnotation(DataScope.class);
    }
    return null;
}
 
Example #4
Source File: SysDeptServiceImpl.java    From RuoYi with Apache License 2.0 5 votes vote down vote up
/**
 * 查询部门管理树
 * @param dept 部门信息
 * @return 所有部门信息
 */
@Override
@DataScope(tableAlias = "d")
public List<Ztree> selectDeptTree(SysDept dept) {
    List<SysDept> deptList = deptMapper.selectDeptList(dept);
    return initZtree(deptList);
}
 
Example #5
Source File: DataScopeAspect.java    From RuoYi with Apache License 2.0 5 votes vote down vote up
/**
 * 是否存在注解,如果存在就获取
 */
private DataScope getAnnotationLog(JoinPoint joinPoint) {
    Signature signature = joinPoint.getSignature();
    MethodSignature methodSignature = (MethodSignature) signature;
    Method method = methodSignature.getMethod();

    if (method != null) {
        return method.getAnnotation(DataScope.class);
    }
    return null;
}
 
Example #6
Source File: DataScopeAspect.java    From RuoYi with Apache License 2.0 5 votes vote down vote up
private void handleDataScope(final JoinPoint joinPoint) {
    // 获得注解
    DataScope controllerDataScope = getAnnotationLog(joinPoint);
    if (controllerDataScope == null) {
        return;
    }
    // 获取当前的用户
    SysUser currentUser = ShiroUtils.getSysUser();
    if (ObjectUtil.isNotNull(currentUser) && !currentUser.isAdmin()) {
        // 如果是超级管理员,则不过滤数据
        dataScopeFilter(joinPoint, currentUser, controllerDataScope.tableAlias());
    }
}
 
Example #7
Source File: SysRoleServiceImpl.java    From ruoyiplus with MIT License 5 votes vote down vote up
/**
 * 根据条件分页查询角色数据
 * 
 * @param role 角色信息
 * @return 角色数据集合信息
 */
@Override
@DataScope(tableAlias = "u")
public List<SysRole> selectRoleList(SysRole role)
{
    return roleMapper.selectRoleList(role);
}
 
Example #8
Source File: SysDeptServiceImpl.java    From ruoyiplus with MIT License 5 votes vote down vote up
/**
 * 查询部门管理树
 * 
 * @param dept 部门信息
 * @return 所有部门信息
 */
@Override
@DataScope(tableAlias = "d")
public List<Map<String, Object>> selectDeptTree(SysDept dept)
{
    List<Map<String, Object>> trees = new ArrayList<Map<String, Object>>();
    List<SysDept> deptList = deptMapper.selectDeptList(dept);
    trees = getTrees(deptList, false, null);
    return trees;
}
 
Example #9
Source File: SysDeptServiceImpl.java    From ruoyiplus with MIT License 5 votes vote down vote up
/**
 * 查询部门管理数据
 * 
 * @param dept 部门信息
 * @return 部门信息集合
 */
@Override
@DataScope(tableAlias = "d")
public List<SysDept> selectDeptList(SysDept dept)
{
    return deptMapper.selectDeptList(dept);
}
 
Example #10
Source File: DataScopeAspect.java    From ruoyiplus with MIT License 5 votes vote down vote up
/**
 * 是否存在注解,如果存在就获取
 */
private DataScope getAnnotationLog(JoinPoint joinPoint)
{
    Signature signature = joinPoint.getSignature();
    MethodSignature methodSignature = (MethodSignature) signature;
    Method method = methodSignature.getMethod();

    if (method != null)
    {
        return method.getAnnotation(DataScope.class);
    }
    return null;
}
 
Example #11
Source File: SysRoleServiceImpl.java    From supplierShop with MIT License 5 votes vote down vote up
/**
 * 根据条件分页查询角色数据
 * 
 * @param role 角色信息
 * @return 角色数据集合信息
 */
@Override
@DataScope(deptAlias = "d")
public List<SysRole> selectRoleList(SysRole role)
{
    return roleMapper.selectRoleList(role);
}
 
Example #12
Source File: SysDeptServiceImpl.java    From supplierShop with MIT License 5 votes vote down vote up
/**
 * 查询部门管理树
 * 
 * @param dept 部门信息
 * @return 所有部门信息
 */
@Override
@DataScope(deptAlias = "d")
public List<Ztree> selectDeptTree(SysDept dept)
{
    List<SysDept> deptList = deptMapper.selectDeptList(dept);
    List<Ztree> ztrees = initZtree(deptList);
    return ztrees;
}
 
Example #13
Source File: SysDeptServiceImpl.java    From supplierShop with MIT License 5 votes vote down vote up
/**
 * 查询部门管理数据
 * 
 * @param dept 部门信息
 * @return 部门信息集合
 */
@Override
@DataScope(deptAlias = "d")
public List<SysDept> selectDeptList(SysDept dept)
{
    return deptMapper.selectDeptList(dept);
}
 
Example #14
Source File: SysUserServiceImpl.java    From supplierShop with MIT License 5 votes vote down vote up
/**
 * 根据条件分页查询用户列表
 * 
 * @param user 用户信息
 * @return 用户信息集合信息
 */
@Override
@DataScope(deptAlias = "d", userAlias = "u")
public List<SysUser> selectUserList(SysUser user)
{
    return userMapper.selectUserList(user);
}
 
Example #15
Source File: SysDeptServiceImpl.java    From RuoYi with Apache License 2.0 4 votes vote down vote up
/**
 * 查询部门管理数据
 *
 * @return 部门信息集合
 */
@Override
@DataScope(tableAlias = "d")
public List<SysDept> selectDeptList(SysDept dept) {
    return deptMapper.selectDeptList(dept);
}
 
Example #16
Source File: SysUserServiceImpl.java    From ruoyiplus with MIT License 3 votes vote down vote up
/**
 * 根据条件分页查询用户对象
 * 
 * @param user 用户信息
 * 
 * @return 用户信息集合信息
 */
@Override
@DataScope(tableAlias = "u")
public List<SysUser> selectUserList(SysUser user)
{
    return userMapper.selectUserList(user);
}
 
Example #17
Source File: SysUserServiceImpl.java    From supplierShop with MIT License 2 votes vote down vote up
/**
 * 根据条件分页查询未分配用户角色列表
 * 
 * @param user 用户信息
 * @return 用户信息集合信息
 */
@DataScope(deptAlias = "d", userAlias = "u")
public List<SysUser> selectUnallocatedList(SysUser user)
{
    return userMapper.selectUnallocatedList(user);
}
 
Example #18
Source File: SysUserServiceImpl.java    From supplierShop with MIT License 2 votes vote down vote up
/**
 * 根据条件分页查询已分配用户角色列表
 * 
 * @param user 用户信息
 * @return 用户信息集合信息
 */
@DataScope(deptAlias = "d", userAlias = "u")
public List<SysUser> selectAllocatedList(SysUser user)
{
    return userMapper.selectAllocatedList(user);
}
 
Example #19
Source File: SysUserServiceImpl.java    From RuoYi with Apache License 2.0 2 votes vote down vote up
/**
 * 根据条件分页查询用户列表
 *
 * @param user 用户信息
 * @return 用户信息集合信息
 */
@Override
@DataScope(tableAlias = "u")
public List<SysUser> selectUserList(SysUser user) {
    return userMapper.selectUserList(user);
}
 
Example #20
Source File: SysUserServiceImpl.java    From RuoYi with Apache License 2.0 2 votes vote down vote up
/**
 * 根据条件分页查询已分配用户角色列表
 *
 * @param user 用户信息
 * @return 用户信息集合信息
 */
@Override
@DataScope(tableAlias = "u")
public List<SysUser> selectAllocatedList(SysUser user) {
    return userMapper.selectAllocatedList(user);
}
 
Example #21
Source File: SysUserServiceImpl.java    From RuoYi with Apache License 2.0 2 votes vote down vote up
/**
 * 根据条件分页查询未分配用户角色列表
 *
 * @param user 用户信息
 * @return 用户信息集合信息
 */
@Override
@DataScope(tableAlias = "u")
public List<SysUser> selectUnallocatedList(SysUser user) {
    return userMapper.selectUnallocatedList(user);
}
 
Example #22
Source File: SysRoleServiceImpl.java    From RuoYi with Apache License 2.0 2 votes vote down vote up
/**
 * 根据条件分页查询角色数据
 *
 * @param role 角色信息
 * @return 角色数据集合信息
 */
@Override
@DataScope(tableAlias = "u")
public List<SysRole> selectRoleList(SysRole role) {
    return roleMapper.selectRoleList(role);
}