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
72
73
package cn.iocoder.yudao.module.mdm.api.item;
 
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.module.mdm.api.item.dto.MdmItemModelRespDTO;
 
import java.util.Collection;
import java.util.List;
import java.util.Map;
 
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertMap;
 
/**
 * MDM 物料型号 API 接口
 *
 * @author 超级管理员
 */
public interface MdmItemModelApi {
 
    String PREFIX = "/rpc-api/mdm/item-model";
 
    /**
     * 获取物料型号
     *
     * @param id 型号编号
     * @return 物料型号
     */
    CommonResult<MdmItemModelRespDTO> getItemModel(Long id);
 
    /**
     * 获取物料型号列表
     *
     * @param ids 型号编号列表
     * @return 物料型号列表
     */
    CommonResult<List<MdmItemModelRespDTO>> getItemModelList(Collection<Long> ids);
 
    /**
     * 获取物料型号 Map
     *
     * @param ids 型号编号列表
     * @return 物料型号 Map
     */
    default Map<Long, MdmItemModelRespDTO> getItemModelMap(Collection<Long> ids) {
        List<MdmItemModelRespDTO> list = getItemModelList(ids).getCheckedData();
        return convertMap(list, MdmItemModelRespDTO::getId);
    }
 
    /**
     * 获取指定物料的型号列表
     *
     * @param itemId 物料编号
     * @return 物料型号列表
     */
    CommonResult<List<MdmItemModelRespDTO>> getItemModelListByItemId(Long itemId);
 
    /**
     * 校验物料型号存在
     *
     * @param id 型号编号
     * @return 物料型号
     */
    CommonResult<MdmItemModelRespDTO> validateItemModelExists(Long id);
 
    /**
     * 校验物料型号存在、启用,且归属于指定物料
     *
     * @param id     型号编号
     * @param itemId 物料编号
     * @return 物料型号
     */
    CommonResult<MdmItemModelRespDTO> validateItemModelExistsAndEnable(Long id, Long itemId);
 
}