package cn.lihu.jh.module.system.api.dept; import cn.lihu.jh.framework.common.enums.CommonStatusEnum; import cn.lihu.jh.framework.common.pojo.CommonResult; import cn.lihu.jh.framework.common.util.collection.CollectionUtils; import cn.lihu.jh.framework.common.util.object.BeanUtils; import cn.lihu.jh.module.system.api.dept.dto.DeptRespDTO; import java.util.Collection; import java.util.List; import java.util.Map; import static cn.lihu.jh.framework.common.pojo.CommonResult.success; /** * 部门 API 接口 * * @author 芋道源码 */ public interface DeptApi { /** * 获得部门信息 * * @param id 部门编号 * @return 部门信息 */ DeptRespDTO getDept(Long id); /** * 获得部门信息数组 * * @param ids 部门编号数组 * @return 部门信息数组 */ List getDeptList(Collection ids); /** * 校验部门们是否有效。如下情况,视为无效: * 1. 部门编号不存在 * 2. 部门被禁用 * * @param ids 角色编号数组 */ void validateDeptList(Collection ids); /** * 获得指定编号的部门 Map * * @param ids 部门编号数组 * @return 部门 Map */ default Map getDeptMap(Collection ids) { List list = getDeptList(ids); return CollectionUtils.convertMap(list, DeptRespDTO::getId); } /** * 获得指定部门的所有子部门 * * @param id 部门编号 * @return 子部门列表 */ List getChildDeptList(Long id); /** * */ List getSimpleDeptList(); }