| | |
| | | |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import cn.hutool.core.convert.Convert; |
| | | import cn.hutool.core.util.ObjectUtil; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.dromara.common.core.utils.StreamUtils; |
| | |
| | | */ |
| | | @Override |
| | | public String getRoleCustom(Long roleId) { |
| | | if (ObjectUtil.isNull(roleId)) { |
| | | return "-1"; |
| | | } |
| | | List<SysRoleDept> list = roleDeptMapper.selectList( |
| | | new LambdaQueryWrapper<SysRoleDept>() |
| | | .select(SysRoleDept::getDeptId) |
| | |
| | | if (CollUtil.isNotEmpty(list)) { |
| | | return StreamUtils.join(list, rd -> Convert.toStr(rd.getDeptId())); |
| | | } |
| | | return null; |
| | | return "-1"; |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @Override |
| | | public String getDeptAndChild(Long deptId) { |
| | | if (ObjectUtil.isNull(deptId)) { |
| | | return "-1"; |
| | | } |
| | | List<SysDept> deptList = deptMapper.selectList(new LambdaQueryWrapper<SysDept>() |
| | | .select(SysDept::getDeptId) |
| | | .apply(DataBaseHelper.findInSet(deptId, "ancestors"))); |
| | |
| | | if (CollUtil.isNotEmpty(ids)) { |
| | | return StreamUtils.join(ids, Convert::toStr); |
| | | } |
| | | return null; |
| | | return "-1"; |
| | | } |
| | | |
| | | } |