package cn.iocoder.yudao.module.member.dal.mysql.billing;

import java.util.*;

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.member.controller.admin.billing.vo.BillingPageReqVO;
import cn.iocoder.yudao.module.member.dal.dataobject.billing.BillingDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 开票记录 Mapper
 *
 * @author 管理员
 */
@Mapper
public interface BillingMapper extends BaseMapperX<BillingDO> {

    default PageResult<BillingDO> selectPage(BillingPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<BillingDO>()
                .likeIfPresent(BillingDO::getUserName, reqVO.getUserName())
                .eqIfPresent(BillingDO::getUserPhone, reqVO.getUserPhone())
                .betweenIfPresent(BillingDO::getRequestBillingTime, reqVO.getRequestBillingTime())
                .eqIfPresent(BillingDO::getBillingMoney, reqVO.getBillingMoney())
                .eqIfPresent(BillingDO::getUserId, reqVO.getUserId())
                .eqIfPresent(BillingDO::getInvoiceId, reqVO.getInvoiceId())
                .eqIfPresent(BillingDO::getStatus, reqVO.getStatus())
                .eqIfPresent(BillingDO::getSystemId, reqVO.getSystemId())
                .eqIfPresent(BillingDO::getBillingType, reqVO.getBillingType())
                .eqIfPresent(BillingDO::getRefuseDetails, reqVO.getRefuseDetails())
                .eqIfPresent(BillingDO::getRemark, reqVO.getRemark())
                .betweenIfPresent(BillingDO::getRefuseTime, reqVO.getRefuseTime())
                .eqIfPresent(BillingDO::getPdfUrl, reqVO.getPdfUrl())
                .betweenIfPresent(BillingDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(BillingDO::getId));
    }

}