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

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.pay.controller.admin.wxorder.vo.WxOrderPageReqVO;
import cn.iocoder.yudao.module.pay.dal.dataobject.wxorder.WxOrderDO;
import org.apache.ibatis.annotations.Mapper;


/**
 * 微信订单 Mapper
 *
 * @author 管理员
 */
@Mapper
public interface WxOrderMapper extends BaseMapperX<WxOrderDO> {

    default PageResult<WxOrderDO> selectPage(WxOrderPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<WxOrderDO>()
                .eqIfPresent(WxOrderDO::getChannelId, reqVO.getChannelId())
                .eqIfPresent(WxOrderDO::getChannelCode, reqVO.getChannelCode())
                .eqIfPresent(WxOrderDO::getOpenId, reqVO.getOpenId())
                .eqIfPresent(WxOrderDO::getTotalPrice, reqVO.getTotalPrice())
                .eqIfPresent(WxOrderDO::getProfitsharingPrice, reqVO.getProfitsharingPrice())
                .eqIfPresent(WxOrderDO::getRefundPrice, reqVO.getRefundPrice())
                .eqIfPresent(WxOrderDO::getOutTradeNo, reqVO.getOutTradeNo())
                .eqIfPresent(WxOrderDO::getTransactionId, reqVO.getTransactionId())
                .betweenIfPresent(WxOrderDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(WxOrderDO::getId));
    }

}