package com.zt.plat.module.contractorder.dal.mysql.entrustorder;

import java.util.*;

import com.zt.plat.framework.common.pojo.PageResult;
import com.zt.plat.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.zt.plat.framework.mybatis.core.mapper.BaseMapperX;

import com.zt.plat.module.contractorder.controller.admin.entrustorder.vo.EntrustOrderDetailPageReqVO;
import com.zt.plat.module.contractorder.dal.dataobject.entrustorder.EntrustOrderDetailDO;
import org.apache.ibatis.annotations.Mapper;


/**
 * 委托加工订单明细 Mapper
 *
 * @author 后台管理-1
 */
@Mapper
public interface EntrustOrderDetailMapper extends BaseMapperX<EntrustOrderDetailDO> {

    default PageResult<EntrustOrderDetailDO> selectPage(EntrustOrderDetailPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<EntrustOrderDetailDO>()
                .eqIfPresent(EntrustOrderDetailDO::getOrderId, reqVO.getOrderId())
                .likeIfPresent(EntrustOrderDetailDO::getReceiveFactoryName, reqVO.getReceiveFactoryName())
                .likeIfPresent(EntrustOrderDetailDO::getReceiveFactoryNumber, reqVO.getReceiveFactoryNumber())
                .likeIfPresent(EntrustOrderDetailDO::getReceiveWarehouseName, reqVO.getReceiveWarehouseName())
                .likeIfPresent(EntrustOrderDetailDO::getReceiveWarehouseNumber, reqVO.getReceiveWarehouseNumber())
                .likeIfPresent(EntrustOrderDetailDO::getSendMaterialName, reqVO.getSendMaterialName())
                .likeIfPresent(EntrustOrderDetailDO::getSendMaterialNumber, reqVO.getSendMaterialNumber())
                .likeIfPresent(EntrustOrderDetailDO::getSendUnit, reqVO.getSendUnit())
                .likeIfPresent(EntrustOrderDetailDO::getReceiveUnit, reqVO.getReceiveUnit())
                .eqIfPresent(EntrustOrderDetailDO::getForecastQuantity, reqVO.getForecastQuantity())
                .eqIfPresent(EntrustOrderDetailDO::getInTaxUnitPrice, reqVO.getInTaxUnitPrice())
                .betweenIfPresent(EntrustOrderDetailDO::getDeliveryCargoBeginDate, reqVO.getDeliveryCargoBeginDate())
                .betweenIfPresent(EntrustOrderDetailDO::getDeliveryCargoEndDate, reqVO.getDeliveryCargoEndDate())
                .eqIfPresent(EntrustOrderDetailDO::getIsEnable, reqVO.getIsEnable())
                .likeIfPresent(EntrustOrderDetailDO::getShortText, reqVO.getShortText())
                .betweenIfPresent(EntrustOrderDetailDO::getCreateTime, reqVO.getCreateTime())
                .likeIfPresent(EntrustOrderDetailDO::getRemark, reqVO.getRemark())
                .eqIfPresent(EntrustOrderDetailDO::getTaxRate, reqVO.getTaxRate())
                .eqIfPresent(EntrustOrderDetailDO::getRecoveryRate, reqVO.getRecoveryRate())
                .eqIfPresent(EntrustOrderDetailDO::getLineNumber, reqVO.getLineNumber())
                .orderByDesc(EntrustOrderDetailDO::getId));
    }

}