2 天以前 111270df037596a04df97f787ca8b9199dd99866
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
package cn.iocoder.yudao.module.mdm.service.item;
 
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.mdm.controller.admin.item.vo.MdmItemPageReqVO;
import cn.iocoder.yudao.module.mdm.controller.admin.item.vo.MdmItemSaveReqVO;
import cn.iocoder.yudao.module.mdm.dal.dataobject.item.MdmItemDO;
import jakarta.validation.Valid;
 
import java.util.Collection;
import java.util.List;
import java.util.Map;
 
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertMap;
 
/**
 * MDM 物料主数据 Service 接口
 *
 * @author 芋道源码
 */
public interface MdmItemService {
 
    /**
     * 创建物料
     *
     * @param createReqVO 创建信息
     * @return 编号
     */
    Long createItem(@Valid MdmItemSaveReqVO createReqVO);
 
    /**
     * 更新物料
     *
     * @param updateReqVO 更新信息
     */
    void updateItem(@Valid MdmItemSaveReqVO updateReqVO);
 
    /**
     * 更新物料状态
     *
     * @param id     编号
     * @param status 状态
     */
    void updateItemStatus(Long id, Integer status);
 
    /**
     * 删除物料
     *
     * @param id 编号
     */
    void deleteItem(Long id);
 
    /**
     * 批量删除物料
     *
     * @param ids 编号列表
     */
    void deleteItemList(Collection<Long> ids);
 
    /**
     * 获得物料
     *
     * @param id 编号
     * @return 物料
     */
    MdmItemDO getItem(Long id);
 
    /**
     * 校验物料存在
     *
     * @param id 编号
     * @return 物料
     */
    MdmItemDO validateItemExists(Long id);
 
    /**
     * 校验物料存在且启用
     *
     * @param id 编号
     * @return 物料
     */
    MdmItemDO validateItemExistsAndEnable(Long id);
 
    /**
     * 获得物料分页
     *
     * @param pageReqVO 分页查询
     * @return 物料分页
     */
    PageResult<MdmItemDO> getItemPage(MdmItemPageReqVO pageReqVO);
 
    /**
     * 获得物料列表
     *
     * @param ids 编号数组
     * @return 物料列表
     */
    List<MdmItemDO> getItemList(Collection<Long> ids);
 
    /**
     * 获得物料 Map
     *
     * @param ids 编号数组
     * @return 物料 Map
     */
    default Map<Long, MdmItemDO> getItemMap(Collection<Long> ids) {
        return convertMap(getItemList(ids), MdmItemDO::getId);
    }
 
    /**
     * 基于物料分类编号,获得物料数量
     *
     * @param categoryId 物料分类编号
     * @return 物料数量
     */
    Long getItemCountByCategoryId(Long categoryId);
 
    /**
     * 基于计量单位编号,获得物料数量
     *
     * @param unitMeasureId 计量单位编号
     * @return 物料数量
     */
    Long getItemCountByUnitMeasureId(Long unitMeasureId);
 
    /**
     * 基于品牌编号,获得物料数量
     *
     * @param brandId 品牌编号
     * @return 物料数量
     */
    Long getItemCountByBrandId(Long brandId);
 
    /**
     * 根据编码获取物料
     *
     * @param code 物料编码
     * @return 物料
     */
    MdmItemDO getItemByCode(String code);
 
}