package cn.iocoder.yudao.module.mdm.dal.mysql.item; import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; import cn.iocoder.yudao.module.mdm.controller.admin.item.vo.MdmItemPageReqVO; import cn.iocoder.yudao.module.mdm.dal.dataobject.item.MdmItemDO; import org.apache.ibatis.annotations.Mapper; import java.util.Collection; import java.util.List; /** * MDM 物料主数据 Mapper * * @author 芋道源码 */ @Mapper public interface MdmItemMapper extends BaseMapperX { default PageResult selectPage(MdmItemPageReqVO reqVO, Collection categoryIds) { return selectPage(reqVO, new LambdaQueryWrapperX() .likeIfPresent(MdmItemDO::getCode, reqVO.getCode()) .likeIfPresent(MdmItemDO::getName, reqVO.getName()) .likeIfPresent(MdmItemDO::getBarCode, reqVO.getBarCode()) .inIfPresent(MdmItemDO::getCategoryId, categoryIds) .eqIfPresent(MdmItemDO::getItemType, reqVO.getItemType()) .eqIfPresent(MdmItemDO::getBrandId, reqVO.getBrandId()) .eqIfPresent(MdmItemDO::getStatus, reqVO.getStatus()) .betweenIfPresent(MdmItemDO::getCreateTime, reqVO.getCreateTime()) .orderByDesc(MdmItemDO::getId)); } default List selectList(MdmItemPageReqVO reqVO, Collection categoryIds) { return selectList(new LambdaQueryWrapperX() .likeIfPresent(MdmItemDO::getCode, reqVO.getCode()) .likeIfPresent(MdmItemDO::getName, reqVO.getName()) .inIfPresent(MdmItemDO::getCategoryId, categoryIds) .eqIfPresent(MdmItemDO::getItemType, reqVO.getItemType()) .eqIfPresent(MdmItemDO::getStatus, reqVO.getStatus()) .orderByDesc(MdmItemDO::getId)); } default MdmItemDO selectByCode(String code) { return selectOne(MdmItemDO::getCode, code); } default MdmItemDO selectByBarCode(String barCode) { return selectOne(MdmItemDO::getBarCode, barCode); } default Long selectCountByCategoryId(Long categoryId) { return selectCount(MdmItemDO::getCategoryId, categoryId); } default Long selectCountByUnitMeasureId(Long unitMeasureId) { return selectCount(MdmItemDO::getUnitMeasureId, unitMeasureId); } default Long selectCountByBrandId(Long brandId) { return selectCount(MdmItemDO::getBrandId, brandId); } default List selectListByIds(Collection ids) { return selectList(MdmItemDO::getId, ids); } }