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

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.api.vo.contract.AmountDismantlePageReqVO;
import com.zt.plat.module.contractorder.dal.dataobject.amountdismantle.AmountDismantleDO;
import org.apache.ibatis.annotations.Mapper;


/**
 * 结算金额拆分 Mapper
 *
 * @author 后台管理-1
 */
@Mapper
public interface AmountDismantleMapper extends BaseMapperX<AmountDismantleDO> {

    default PageResult<AmountDismantleDO> selectPage(AmountDismantlePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<AmountDismantleDO>()
                .likeIfPresent(AmountDismantleDO::getMaterialName, reqVO.getMaterialName())
                .eqIfPresent(AmountDismantleDO::getMaterialNumber, reqVO.getMaterialNumber())
                .eqIfPresent(AmountDismantleDO::getElementAbbreviation, reqVO.getElementAbbreviation())
                .likeIfPresent(AmountDismantleDO::getElementName, reqVO.getElementName())
                .eqIfPresent(AmountDismantleDO::getElementCode, reqVO.getElementCode())
                .eqIfPresent(AmountDismantleDO::getProportion, reqVO.getProportion())
                .eqIfPresent(AmountDismantleDO::getContractId, reqVO.getContractId())
                .betweenIfPresent(AmountDismantleDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(AmountDismantleDO::getId));
    }

}