Search in sources :

Example 1 with AgileSysRoleDept

use of com.jeeagile.system.entity.AgileSysRoleDept in project jeeagile by jeeagile.

the class AgileSysRoleServiceImpl method selectRoleDeptIdList.

/**
 * 查询角色已分配数据权限
 *
 * @param roleId
 * @return
 */
private List<String> selectRoleDeptIdList(Serializable roleId) {
    LambdaQueryWrapper<AgileSysRoleDept> lambdaQueryWrapper = new LambdaQueryWrapper<>();
    lambdaQueryWrapper.eq(AgileSysRoleDept::getRoleId, roleId);
    List<AgileSysRoleDept> roleDeptList = agileSysRoleDeptService.list(lambdaQueryWrapper);
    List<String> roleDeptIdList = new ArrayList<>();
    for (AgileSysRoleDept sysRoleDept : roleDeptList) {
        if (agileSysDeptService.countChild(sysRoleDept.getDeptId()) < 1) {
            roleDeptIdList.add(sysRoleDept.getDeptId());
        }
    }
    return roleDeptIdList;
}
Also used : AgileSysRoleDept(com.jeeagile.system.entity.AgileSysRoleDept) ArrayList(java.util.ArrayList) LambdaQueryWrapper(com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper)

Example 2 with AgileSysRoleDept

use of com.jeeagile.system.entity.AgileSysRoleDept in project jeeagile by jeeagile.

the class AgileSysRoleServiceImpl method saveRoleDept.

/**
 * 保存角色部门数据
 *
 * @param agileSysRole
 * @return
 */
private boolean saveRoleDept(AgileSysRole agileSysRole) {
    if (AgileCollectionUtil.isNotEmpty(agileSysRole.getDeptIdList())) {
        List<AgileSysRoleDept> agileSysRoleDeptList = new ArrayList<>();
        for (String deptId : agileSysRole.getDeptIdList()) {
            AgileSysRoleDept agileSysRoleDept = new AgileSysRoleDept();
            agileSysRoleDept.setRoleId(agileSysRole.getId());
            agileSysRoleDept.setDeptId(deptId);
            agileSysRoleDeptList.add(agileSysRoleDept);
        }
        return agileSysRoleDeptService.saveBatch(agileSysRoleDeptList);
    } else {
        return true;
    }
}
Also used : AgileSysRoleDept(com.jeeagile.system.entity.AgileSysRoleDept) ArrayList(java.util.ArrayList)

Aggregations

AgileSysRoleDept (com.jeeagile.system.entity.AgileSysRoleDept)2 ArrayList (java.util.ArrayList)2 LambdaQueryWrapper (com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper)1