package cn.iocoder.yudao.module.pay.dal.mysql.refundrecord;

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.pay.controller.admin.refundrecord.vo.RefundRecordPageReqVO;
import cn.iocoder.yudao.module.pay.dal.dataobject.refundrecord.RefundRecordDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 退款记录 Mapper
 *
 * @author 管理员
 */
@Mapper
public interface RefundRecordMapper extends BaseMapperX<RefundRecordDO> {

    default PageResult<RefundRecordDO> selectPage(RefundRecordPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<RefundRecordDO>()
                .eqIfPresent(RefundRecordDO::getChannelId, reqVO.getChannelId())
                .eqIfPresent(RefundRecordDO::getChannelCode, reqVO.getChannelCode())
                .eqIfPresent(RefundRecordDO::getChannelUserId, reqVO.getChannelUserId())
                .eqIfPresent(RefundRecordDO::getUserId, reqVO.getUserId())
                .eqIfPresent(RefundRecordDO::getTotalPrice, reqVO.getTotalPrice())
                .eqIfPresent(RefundRecordDO::getStatus, reqVO.getStatus())
                .eqIfPresent(RefundRecordDO::getOutTradeNo, reqVO.getOutTradeNo())
                .eqIfPresent(RefundRecordDO::getTransactionId, reqVO.getTransactionId())
                .eqIfPresent(RefundRecordDO::getOutRefundNo, reqVO.getOutRefundNo())
                .eqIfPresent(RefundRecordDO::getRefundId, reqVO.getRefundId())
                .betweenIfPresent(RefundRecordDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(RefundRecordDO::getId));
    }

}