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<DeptRespDTO> getDeptList(Collection<Long> ids);
|
|
/**
|
* 校验部门们是否有效。如下情况,视为无效:
|
* 1. 部门编号不存在
|
* 2. 部门被禁用
|
*
|
* @param ids 角色编号数组
|
*/
|
void validateDeptList(Collection<Long> ids);
|
|
/**
|
* 获得指定编号的部门 Map
|
*
|
* @param ids 部门编号数组
|
* @return 部门 Map
|
*/
|
default Map<Long, DeptRespDTO> getDeptMap(Collection<Long> ids) {
|
List<DeptRespDTO> list = getDeptList(ids);
|
return CollectionUtils.convertMap(list, DeptRespDTO::getId);
|
}
|
|
/**
|
* 获得指定部门的所有子部门
|
*
|
* @param id 部门编号
|
* @return 子部门列表
|
*/
|
List<DeptRespDTO> getChildDeptList(Long id);
|
|
/**
|
*
|
*/
|
List<DeptRespDTO> getSimpleDeptList();
|
|
}
|