package com.zt.plat.module.erp.dal.mysql.erp;

import com.zt.plat.framework.common.pojo.PageResult;
import com.zt.plat.framework.mybatis.core.mapper.BaseMapperX;
import com.zt.plat.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.zt.plat.module.erp.controller.admin.erp.vo.ErpContractPageReqVO;
import com.zt.plat.module.erp.dal.dataobject.erp.ErpContractDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * ERP合同映射 Mapper
 *
 * @author 后台管理
 */
@Mapper
public interface ErpContractMapper extends BaseMapperX<ErpContractDO> {

    default PageResult<ErpContractDO> selectPage(ErpContractPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<ErpContractDO>()
                .eqIfPresent(ErpContractDO::getOperationId, reqVO.getOperationId())
                .eqIfPresent(ErpContractDO::getContractMainId, reqVO.getContractMainId())
                .likeIfPresent(ErpContractDO::getContractPaperNumber, reqVO.getContractPaperNumber())
                .likeIfPresent(ErpContractDO::getContractName, reqVO.getContractName())
                .likeIfPresent(ErpContractDO::getContractTypeNumber, reqVO.getContractTypeNumber())
                .likeIfPresent(ErpContractDO::getContractTypeName, reqVO.getContractTypeName())
                .eqIfPresent(ErpContractDO::getContractCategory, reqVO.getContractCategory())
                .eqIfPresent(ErpContractDO::getIsVirtualContract, reqVO.getIsVirtualContract())
                .likeIfPresent(ErpContractDO::getSupplierNumber, reqVO.getSupplierNumber())
                .likeIfPresent(ErpContractDO::getSupplierName, reqVO.getSupplierName())
                .eqIfPresent(ErpContractDO::getAgent, reqVO.getAgent())
                .likeIfPresent(ErpContractDO::getContractImplementNumber, reqVO.getContractImplementNumber())
                .likeIfPresent(ErpContractDO::getContractSignNumber, reqVO.getContractSignNumber())
                .betweenIfPresent(ErpContractDO::getSignDate, reqVO.getSignDate())
                .betweenIfPresent(ErpContractDO::getStartDate, reqVO.getStartDate())
                .betweenIfPresent(ErpContractDO::getStopDate, reqVO.getStopDate())
                .eqIfPresent(ErpContractDO::getCurrency, reqVO.getCurrency())
                .eqIfPresent(ErpContractDO::getSourceAmount, reqVO.getSourceAmount())
                .eqIfPresent(ErpContractDO::getBasicAmount, reqVO.getBasicAmount())
                .eqIfPresent(ErpContractDO::getChangeSourceAmount, reqVO.getChangeSourceAmount())
                .eqIfPresent(ErpContractDO::getChangeBasicAmount, reqVO.getChangeBasicAmount())
                .eqIfPresent(ErpContractDO::getStatusNumber, reqVO.getStatusNumber())
                .likeIfPresent(ErpContractDO::getStatusName, reqVO.getStatusName())
                .eqIfPresent(ErpContractDO::getIsPrepayment, reqVO.getIsPrepayment())
                .eqIfPresent(ErpContractDO::getPrepaymentRatio, reqVO.getPrepaymentRatio())
                .eqIfPresent(ErpContractDO::getPrepaymentAmount, reqVO.getPrepaymentAmount())
                .eqIfPresent(ErpContractDO::getSourceBeforeBond, reqVO.getSourceBeforeBond())
                .eqIfPresent(ErpContractDO::getBasicBeforeBond, reqVO.getBasicBeforeBond())
                .eqIfPresent(ErpContractDO::getSourceAfterBond, reqVO.getSourceAfterBond())
                .eqIfPresent(ErpContractDO::getBasicAfterBond, reqVO.getBasicAfterBond())
                .eqIfPresent(ErpContractDO::getIsQualityassuranceAmount, reqVO.getIsQualityassuranceAmount())
                .eqIfPresent(ErpContractDO::getQualityassuranceRatio, reqVO.getQualityassuranceRatio())
                .eqIfPresent(ErpContractDO::getQualityassuranceAmount, reqVO.getQualityassuranceAmount())
                .eqIfPresent(ErpContractDO::getIsInternal, reqVO.getIsInternal())
                .eqIfPresent(ErpContractDO::getNature, reqVO.getNature())
                .likeIfPresent(ErpContractDO::getRemark, reqVO.getRemark())
                .eqIfPresent(ErpContractDO::getSourceAccumulateSettlementAmount, reqVO.getSourceAccumulateSettlementAmount())
                .eqIfPresent(ErpContractDO::getBasicAccumulateSettlementAmount, reqVO.getBasicAccumulateSettlementAmount())
                .eqIfPresent(ErpContractDO::getSourceUseAmount, reqVO.getSourceUseAmount())
                .eqIfPresent(ErpContractDO::getBasicUseAmount, reqVO.getBasicUseAmount())
                .eqIfPresent(ErpContractDO::getSourceInvoiceAmount, reqVO.getSourceInvoiceAmount())
                .eqIfPresent(ErpContractDO::getBasicInvoiceAmount, reqVO.getBasicInvoiceAmount())
                .eqIfPresent(ErpContractDO::getSourceAccumulatePrepayment, reqVO.getSourceAccumulatePrepayment())
                .eqIfPresent(ErpContractDO::getBasicAccumulatePrepayment, reqVO.getBasicAccumulatePrepayment())
                .eqIfPresent(ErpContractDO::getSourceAccumulateBond, reqVO.getSourceAccumulateBond())
                .eqIfPresent(ErpContractDO::getBasicAccumulateBond, reqVO.getBasicAccumulateBond())
                .eqIfPresent(ErpContractDO::getSourceAccumulateAmount, reqVO.getSourceAccumulateAmount())
                .eqIfPresent(ErpContractDO::getBasicAccumulateAmount, reqVO.getBasicAccumulateAmount())
                .eqIfPresent(ErpContractDO::getIsFramework, reqVO.getIsFramework())
                .eqIfPresent(ErpContractDO::getIsDomestic, reqVO.getIsDomestic())
                .eqIfPresent(ErpContractDO::getArchitectureService‌Place, reqVO.getArchitectureService‌Place())
                .eqIfPresent(ErpContractDO::getPayeeConditionAmount, reqVO.getPayeeConditionAmount())
                .betweenIfPresent(ErpContractDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(ErpContractDO::getId));
    }

}