package cn.iocoder.yudao.module.bpm.dal.mysql.oa;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.bpm.controller.admin.oa.vo.supplierpurchasepayment.BpmOASupplierPurchasePaymentPageReqVO;
import cn.iocoder.yudao.module.bpm.dal.dataobject.oa.BpmOASupplierPurchasePaymentDO;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

/**
 * 供应商采购付款 Mapper
 *
 * @author 艾楷
 */
@Mapper
public interface BpmOASupplierPurchasePaymentMapper extends BaseMapperX<BpmOASupplierPurchasePaymentDO> {

    default PageResult<BpmOASupplierPurchasePaymentDO> selectPage(BpmOASupplierPurchasePaymentPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<BpmOASupplierPurchasePaymentDO>()
                .eqIfPresent(BpmOASupplierPurchasePaymentDO::getUserId, reqVO.getUserId())
                .eqIfPresent(BpmOASupplierPurchasePaymentDO::getSupplierId, reqVO.getSupplierId())
                .eqIfPresent(BpmOASupplierPurchasePaymentDO::getSettlementMethod, reqVO.getSettlementMethod())
                .eqIfPresent(BpmOASupplierPurchasePaymentDO::getSupplierProcurementPlanIds, reqVO.getSupplierProcurementPlanIds())
                .eqIfPresent(BpmOASupplierPurchasePaymentDO::getRemark, reqVO.getRemark())
                .eqIfPresent(BpmOASupplierPurchasePaymentDO::getFileItems, reqVO.getFileItems())
                .eqIfPresent(BpmOASupplierPurchasePaymentDO::getResult, reqVO.getResult())
                .eqIfPresent(BpmOASupplierPurchasePaymentDO::getProcessInstanceId, reqVO.getProcessInstanceId())
                .betweenIfPresent(BpmOASupplierPurchasePaymentDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(BpmOASupplierPurchasePaymentDO::getId));
    }

    /**
     * 通过id获取
     *
     * @param id
     * @return
     */
    BpmOASupplierPurchasePaymentDO getById(@Param("id") Long id);

    /**
     * 列表
     *
     * @param vo
     * @param page
     * @return
     */
    IPage<BpmOASupplierPurchasePaymentDO> getOASupplierPurchasePaymentPage(@Param("vo") BpmOASupplierPurchasePaymentPageReqVO vo, @Param("page") Page<Object> page);
}
