package cn.iocoder.yudao.module.member.dal.mysql.storegoodsinventory;

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.member.controller.admin.storegoodsinventory.vo.StoreGoodsInventoryPageReqVO;
import cn.iocoder.yudao.module.member.dal.dataobject.storegoodsinventory.StoreGoodsInventoryDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 商品库存 Mapper
 *
 * @author 管理员
 */
@Mapper
public interface StoreGoodsInventoryMapper extends BaseMapperX<StoreGoodsInventoryDO> {

    default PageResult<StoreGoodsInventoryDO> selectPage(StoreGoodsInventoryPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<StoreGoodsInventoryDO>()
                .eqIfPresent(StoreGoodsInventoryDO::getGoodsId, reqVO.getGoodsId())
                .eqIfPresent(StoreGoodsInventoryDO::getCarteenId, reqVO.getCarteenId())
                .eqIfPresent(StoreGoodsInventoryDO::getNumber, reqVO.getNumber())
                .eqIfPresent(StoreGoodsInventoryDO::getWeight, reqVO.getWeight())
                .betweenIfPresent(StoreGoodsInventoryDO::getCreateTime, reqVO.getCreateTime())
                .inIfPresent(StoreGoodsInventoryDO::getGoodsId, reqVO.getGoodsIds())
                .orderByDesc(StoreGoodsInventoryDO::getId));
    }

}