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
package cn.lihu.jh.module.system.api.dept;
 
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.map.MapUtil;
import cn.lihu.jh.framework.common.util.collection.CollectionUtils;
import cn.lihu.jh.module.system.api.dept.dto.PostRespDTO;
 
import java.util.Collection;
import java.util.List;
import java.util.Map;
 
/**
 * 岗位 API 接口
 *
 * @author 芋道源码
 */
public interface PostApi {
 
    /**
     * 校验岗位们是否有效。如下情况,视为无效:
     * 1. 岗位编号不存在
     * 2. 岗位被禁用
     *
     * @param ids 岗位编号数组
     */
    void validPostList(Collection<Long> ids);
 
    List<PostRespDTO> getPostList(Collection<Long> ids);
 
    default Map<Long, PostRespDTO> getPostMap(Collection<Long> ids) {
        if (CollUtil.isEmpty(ids)) {
            return MapUtil.empty();
        }
 
        List<PostRespDTO> list = getPostList(ids);
        return CollectionUtils.convertMap(list, PostRespDTO::getId);
    }
 
}