package cn.iocoder.yudao.module.mes.dal.mysql.stockworkshop;

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.mes.controller.admin.stockworkshop.vo.StockWorkshopDetailPageReqVO;
import cn.iocoder.yudao.module.mes.dal.dataobject.stockworkshop.StockWorkshopDetailDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 车间仓明细 Mapper
 *
 * @author 内蒙必硕
 */
@Mapper
public interface StockWorkshopDetailMapper extends BaseMapperX<StockWorkshopDetailDO> {

    default PageResult<StockWorkshopDetailDO> selectPage(StockWorkshopDetailPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<StockWorkshopDetailDO>()
                .eqIfPresent(StockWorkshopDetailDO::getItemId, reqVO.getItemId())
                .eqIfPresent(StockWorkshopDetailDO::getCount, reqVO.getCount())
                .eqIfPresent(StockWorkshopDetailDO::getDetailType, reqVO.getDetailType())
                .eqIfPresent(StockWorkshopDetailDO::getItemRequisitionCode, reqVO.getItemRequisitionCode())
                .eqIfPresent(StockWorkshopDetailDO::getItemRequisitionDetailId, reqVO.getItemRequisitionDetailId())
                .eqIfPresent(StockWorkshopDetailDO::getFeedingRecordCode, reqVO.getFeedingRecordCode())
                .eqIfPresent(StockWorkshopDetailDO::getFeedingRecordId, reqVO.getFeedingRecordId())
                .eqIfPresent(StockWorkshopDetailDO::getUserId, reqVO.getUserId())
                .betweenIfPresent(StockWorkshopDetailDO::getOperateTime, reqVO.getOperateTime())
                .betweenIfPresent(StockWorkshopDetailDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(StockWorkshopDetailDO::getId));
    }

}