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.EntrustOrderOrderPageReqVO;
import com.zt.plat.module.contractorder.controller.admin.entrustorder.vo.EntrustOrderOrderSaveReqVO;
import com.zt.plat.module.contractorder.controller.admin.purchaseorder.vo.PurchaseOrderPageReqVO;
import com.zt.plat.module.contractorder.dal.dataobject.entrustorder.EntrustOrderOrderDO;
import org.apache.ibatis.annotations.Mapper;


/**
 *  Mapper
 *
 * @author 后台管理-1
 */
@Mapper
public interface EntrustOrderOrderMapper extends BaseMapperX<EntrustOrderOrderDO> {

    default PageResult<EntrustOrderOrderDO> selectPage(EntrustOrderOrderPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<EntrustOrderOrderDO>()
                .eqIfPresent(EntrustOrderOrderDO::getOrderSAPNumber, reqVO.getOrderSAPNumber())
                .eqIfPresent(EntrustOrderOrderDO::getSystemOrderNumber, reqVO.getSystemOrderNumber())
                .eqIfPresent(EntrustOrderOrderDO::getCpName, reqVO.getCpName())
                .eqIfPresent(EntrustOrderOrderDO::getSupplierNumber, reqVO.getSupplierNumber())
                .likeIfPresent(EntrustOrderOrderDO::getSupplierName, reqVO.getSupplierName())
                .eqIfPresent(EntrustOrderOrderDO::getType, reqVO.getType())
                .eqIfPresent(EntrustOrderOrderDO::getVoucherDate, reqVO.getVoucherDate())
                .eqIfPresent(EntrustOrderOrderDO::getPurchaseOrganizationCustomsDeclaration, reqVO.getPurchaseOrganizationCustomsDeclaration())
                .likeIfPresent(EntrustOrderOrderDO::getReceiveFactoryName, reqVO.getReceiveFactoryName())
                .eqIfPresent(EntrustOrderOrderDO::getReceiveFactoryNumber, reqVO.getReceiveFactoryNumber())
                .likeIfPresent(EntrustOrderOrderDO::getReceiveWarehouseName, reqVO.getReceiveWarehouseName())
                .eqIfPresent(EntrustOrderOrderDO::getReceiveWarehouseNumber, reqVO.getReceiveWarehouseNumber())
                .eqIfPresent(EntrustOrderOrderDO::getPurchaseGroup, reqVO.getPurchaseGroup())
                .eqIfPresent(EntrustOrderOrderDO::getCurrencyNumber, reqVO.getCurrencyNumber())
                .eqIfPresent(EntrustOrderOrderDO::getExchangeRate, reqVO.getExchangeRate())
                .eqIfPresent(EntrustOrderOrderDO::getPaperContractNumber, reqVO.getPaperContractNumber())
                .eqIfPresent(EntrustOrderOrderDO::getAgreementNumber, reqVO.getAgreementNumber())
                .eqIfPresent(EntrustOrderOrderDO::getRemark, reqVO.getRemark())
                .eqIfPresent(EntrustOrderOrderDO::getAgentNumber, reqVO.getAgentNumber())
                .likeIfPresent(EntrustOrderOrderDO::getAgentName, reqVO.getAgentName())
            //    .eqIfPresent(EntrustOrderOrderDO::getOrderNumber, reqVO.getOrderNumber())
                .eqIfPresent(EntrustOrderOrderDO::getContractNumber, reqVO.getContractNumber())
                .likeIfPresent(EntrustOrderOrderDO::getMaterialNumber, reqVO.getMaterialNumber())
                .likeIfPresent(EntrustOrderOrderDO::getMaterialName, reqVO.getMaterialName())
                .likeIfPresent(EntrustOrderOrderDO::getContractName, reqVO.getContractName())
                .eqIfPresent(EntrustOrderOrderDO::getTenantNumber, reqVO.getTenantNumber())
                .betweenIfPresent(EntrustOrderOrderDO::getCreateTime, reqVO.getCreateTime())
                .eqIfPresent(EntrustOrderOrderDO::getErpPurchaseCompanyNumber, reqVO.getErpPurchaseCompanyNumber())
                .likeIfPresent(EntrustOrderOrderDO::getErpPurchaseCompanyName, reqVO.getErpPurchaseCompanyName())
                .eqIfPresent(EntrustOrderOrderDO::getErpSalesCompanyNumber, reqVO.getErpSalesCompanyNumber())
                .likeIfPresent(EntrustOrderOrderDO::getErpSalesCompanyName, reqVO.getErpSalesCompanyName())
                .likeIfPresent(EntrustOrderOrderDO::getPurchaseOrganizationName, reqVO.getPurchaseOrganizationName())
                .eqIfPresent(EntrustOrderOrderDO::getErpStatus, reqVO.getErpStatus())
                .eqIfPresent(EntrustOrderOrderDO::getCause, reqVO.getCause())
                .eqIfPresent(EntrustOrderOrderDO::getStatus, reqVO.getStatus())
                .likeIfPresent(EntrustOrderOrderDO::getPurchaseGroupName, reqVO.getPurchaseGroupName())
                .likeIfPresent(EntrustOrderOrderDO::getUnit, reqVO.getUnit())
                .likeIfPresent(EntrustOrderOrderDO::getSplyBsnTp, reqVO.getSplyBsnTp())
                .orderByDesc(EntrustOrderOrderDO::getId));
    }

}