eight
2024-08-13 7660fe12273a6b132256a2fa83ca1b11d6b2381f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
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();
 
}