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 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 getItemPage(MdmItemPageReqVO pageReqVO); /** * 获得物料列表 * * @param ids 编号数组 * @return 物料列表 */ List getItemList(Collection ids); /** * 获得物料 Map * * @param ids 编号数组 * @return 物料 Map */ default Map getItemMap(Collection 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); }