use of com.jun.plugin.system.vo.resp.DeptRespNodeVO in project jun_springboot_api_service by wujun728.
the class DeptServiceImpl method getChild.
private List<DeptRespNodeVO> getChild(String id, List<SysDept> all) {
List<DeptRespNodeVO> list = new ArrayList<>();
for (SysDept sysDept : all) {
if (sysDept.getPid().equals(id)) {
DeptRespNodeVO deptTree = new DeptRespNodeVO();
BeanUtils.copyProperties(sysDept, deptTree);
deptTree.setTitle(sysDept.getName());
deptTree.setChildren(getChild(sysDept.getId(), all));
list.add(deptTree);
}
}
return list;
}
use of com.jun.plugin.system.vo.resp.DeptRespNodeVO in project jun_springboot_api_service by wujun728.
the class DeptServiceImpl method deptTreeList.
@Override
public List<DeptRespNodeVO> deptTreeList(String deptId, Boolean disabled) {
List<SysDept> list;
if (StringUtils.isEmpty(deptId)) {
list = sysDeptMapper.selectList(Wrappers.emptyWrapper());
} else {
SysDept sysDept = sysDeptMapper.selectById(deptId);
if (sysDept == null) {
throw new BusinessException(BaseResponseCode.DATA_ERROR);
}
LambdaQueryWrapper<SysDept> queryWrapper = Wrappers.<SysDept>lambdaQuery().likeRight(SysDept::getRelationCode, sysDept.getRelationCode());
List<Object> childIds = sysDeptMapper.selectObjs(queryWrapper);
list = sysDeptMapper.selectList(Wrappers.<SysDept>lambdaQuery().notIn(SysDept::getId, childIds));
}
// 默认加一个顶级方便新增顶级部门
DeptRespNodeVO respNodeVO = new DeptRespNodeVO();
respNodeVO.setTitle("默认顶级部门");
respNodeVO.setId("0");
respNodeVO.setSpread(true);
respNodeVO.setDisabled(disabled);
respNodeVO.setChildren(getTree(list));
List<DeptRespNodeVO> result = new ArrayList<>();
result.add(respNodeVO);
return result;
}
use of com.jun.plugin.system.vo.resp.DeptRespNodeVO in project jun_springboot_api_service by wujun728.
the class RoleServiceImpl method detailInfo.
@Override
public SysRole detailInfo(String id) {
SysRole sysRole = sysRoleMapper.selectById(id);
if (sysRole == null) {
log.error("传入 的 id:{}不合法", id);
throw new BusinessException(BaseResponseCode.DATA_ERROR);
}
List<PermissionRespNode> permissionRespNodes = permissionService.selectAllByTree();
LambdaQueryWrapper<SysRolePermission> queryWrapper = Wrappers.<SysRolePermission>lambdaQuery().select(SysRolePermission::getPermissionId).eq(SysRolePermission::getRoleId, sysRole.getId());
Set<Object> checkList = new HashSet<>(rolePermissionService.listObjs(queryWrapper));
setChecked(permissionRespNodes, checkList);
sysRole.setPermissionRespNodes(permissionRespNodes);
LambdaQueryWrapper<SysRoleDeptEntity> queryWrapperDept = Wrappers.<SysRoleDeptEntity>lambdaQuery().select(SysRoleDeptEntity::getDeptId).eq(SysRoleDeptEntity::getRoleId, sysRole.getId());
List<DeptRespNodeVO> deptRespNodes = deptService.deptTreeList(null, true);
Set<Object> checkDeptList = new HashSet<>(sysRoleDeptService.listObjs(queryWrapperDept));
setCheckedDept(deptRespNodes, checkDeptList);
sysRole.setDeptRespNodes(deptRespNodes);
return sysRole;
}
use of com.jun.plugin.system.vo.resp.DeptRespNodeVO in project jun_springboot_api_service by wujun728.
the class DeptServiceImpl method getTree.
private List<DeptRespNodeVO> getTree(List<SysDept> all) {
List<DeptRespNodeVO> list = new ArrayList<>();
for (SysDept sysDept : all) {
if ("0".equals(sysDept.getPid())) {
DeptRespNodeVO deptTree = new DeptRespNodeVO();
BeanUtils.copyProperties(sysDept, deptTree);
deptTree.setTitle(sysDept.getName());
deptTree.setSpread(true);
deptTree.setChildren(getChild(sysDept.getId(), all));
list.add(deptTree);
}
}
return list;
}
Aggregations