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

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.salesorder.vo.SalesOrderDetailPageReqVO;
import com.zt.plat.module.contractorder.dal.dataobject.salesorder.SalesOrderDetailDO;
import org.apache.ibatis.annotations.Mapper;


/**
 * 销售订单明细 Mapper
 *
 * @author 后台管理-1
 */
@Mapper
public interface SalesOrderDetailMapper extends BaseMapperX<SalesOrderDetailDO> {

    default PageResult<SalesOrderDetailDO> selectPage(SalesOrderDetailPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<SalesOrderDetailDO>()
                .eqIfPresent(SalesOrderDetailDO::getOrderId, reqVO.getOrderId())
                .eqIfPresent(SalesOrderDetailDO::getLineNumber, reqVO.getLineNumber())
                .likeIfPresent(SalesOrderDetailDO::getMaterialName, reqVO.getMaterialName())
                .eqIfPresent(SalesOrderDetailDO::getMaterialNumber, reqVO.getMaterialNumber())
                .likeIfPresent(SalesOrderDetailDO::getFactoryName, reqVO.getFactoryName())
                .eqIfPresent(SalesOrderDetailDO::getFactoryNumber, reqVO.getFactoryNumber())
                .likeIfPresent(SalesOrderDetailDO::getWarehouseName, reqVO.getWarehouseName())
                .eqIfPresent(SalesOrderDetailDO::getWarehouseNumber, reqVO.getWarehouseNumber())
                .eqIfPresent(SalesOrderDetailDO::getUnt, reqVO.getUnt())
                .eqIfPresent(SalesOrderDetailDO::getInvoiceType, reqVO.getInvoiceType())
                .eqIfPresent(SalesOrderDetailDO::getQuantity, reqVO.getQuantity())
                .eqIfPresent(SalesOrderDetailDO::getTaxAcctasscat, reqVO.getTaxAcctasscat())
                .eqIfPresent(SalesOrderDetailDO::getProjectCategory, reqVO.getProjectCategory())
                .eqIfPresent(SalesOrderDetailDO::getShippingPlace, reqVO.getShippingPlace())
                .eqIfPresent(SalesOrderDetailDO::getMetalAcctasscatGroup, reqVO.getMetalAcctasscatGroup())
                .eqIfPresent(SalesOrderDetailDO::getAgreementNumber, reqVO.getAgreementNumber())
                .eqIfPresent(SalesOrderDetailDO::getGross, reqVO.getGross())
                .eqIfPresent(SalesOrderDetailDO::getElementAbbreviation, reqVO.getElementAbbreviation())
                .likeIfPresent(SalesOrderDetailDO::getElementName, reqVO.getElementName())
                .eqIfPresent(SalesOrderDetailDO::getElementNumber, reqVO.getElementNumber())
                .eqIfPresent(SalesOrderDetailDO::getIsEnable, reqVO.getIsEnable())
                .eqIfPresent(SalesOrderDetailDO::getPriceConditionDetail, reqVO.getPriceConditionDetail())
                .eqIfPresent(SalesOrderDetailDO::getOriginDetail, reqVO.getOriginDetail())
                .betweenIfPresent(SalesOrderDetailDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(SalesOrderDetailDO::getId));
    }

}
