package com.yolo.keyboard.dal.mysql.tenantwithdraworder;

import java.util.*;

import com.yolo.keyboard.framework.common.pojo.PageResult;
import com.yolo.keyboard.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.yolo.keyboard.framework.mybatis.core.mapper.BaseMapperX;
import com.yolo.keyboard.dal.dataobject.tenantwithdraworder.KeyboardTenantWithdrawOrderDO;
import org.apache.ibatis.annotations.Mapper;
import com.yolo.keyboard.controller.admin.tenantwithdraworder.vo.*;

/**
 * 租户提现订单表（申请-审核-打款-完成/失败） Mapper
 *
 * @author ziin
 */
@Mapper
public interface KeyboardTenantWithdrawOrderMapper extends BaseMapperX<KeyboardTenantWithdrawOrderDO> {

    default PageResult<KeyboardTenantWithdrawOrderDO> selectPage(KeyboardTenantWithdrawOrderPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<KeyboardTenantWithdrawOrderDO>()
                .inIfPresent(KeyboardTenantWithdrawOrderDO::getTenantId, reqVO.getTenantIds())
                .eqIfPresent(KeyboardTenantWithdrawOrderDO::getWithdrawNo, reqVO.getWithdrawNo())
                .eqIfPresent(KeyboardTenantWithdrawOrderDO::getBizNo, reqVO.getBizNo())
                .eqIfPresent(KeyboardTenantWithdrawOrderDO::getCurrency, reqVO.getCurrency())
                .eqIfPresent(KeyboardTenantWithdrawOrderDO::getAmount, reqVO.getAmount())
                .eqIfPresent(KeyboardTenantWithdrawOrderDO::getFeeAmount, reqVO.getFeeAmount())
                .eqIfPresent(KeyboardTenantWithdrawOrderDO::getActualAmount, reqVO.getActualAmount())
                .eqIfPresent(KeyboardTenantWithdrawOrderDO::getPayChannel, reqVO.getPayChannel())
                .eqIfPresent(KeyboardTenantWithdrawOrderDO::getPayeeType, reqVO.getPayeeType())
                .likeIfPresent(KeyboardTenantWithdrawOrderDO::getPayeeName, reqVO.getPayeeName())
                .eqIfPresent(KeyboardTenantWithdrawOrderDO::getPayeeAccount, reqVO.getPayeeAccount())
                .likeIfPresent(KeyboardTenantWithdrawOrderDO::getPayeeBankName, reqVO.getPayeeBankName())
                .eqIfPresent(KeyboardTenantWithdrawOrderDO::getPayeeBankCode, reqVO.getPayeeBankCode())
                .eqIfPresent(KeyboardTenantWithdrawOrderDO::getPayeeBankBranch, reqVO.getPayeeBankBranch())
                .eqIfPresent(KeyboardTenantWithdrawOrderDO::getStatus, reqVO.getStatus())
                .eqIfPresent(KeyboardTenantWithdrawOrderDO::getAuditStatus, reqVO.getAuditStatus())
                .eqIfPresent(KeyboardTenantWithdrawOrderDO::getReason, reqVO.getReason())
                .betweenIfPresent(KeyboardTenantWithdrawOrderDO::getApplyTime, reqVO.getApplyTime())
                .betweenIfPresent(KeyboardTenantWithdrawOrderDO::getAuditTime, reqVO.getAuditTime())
                .betweenIfPresent(KeyboardTenantWithdrawOrderDO::getPayTime, reqVO.getPayTime())
                .betweenIfPresent(KeyboardTenantWithdrawOrderDO::getPaidTime, reqVO.getPaidTime())
                .betweenIfPresent(KeyboardTenantWithdrawOrderDO::getFinishTime, reqVO.getFinishTime())
                .eqIfPresent(KeyboardTenantWithdrawOrderDO::getPayerBatchNo, reqVO.getPayerBatchNo())
                .eqIfPresent(KeyboardTenantWithdrawOrderDO::getChannelTradeNo, reqVO.getChannelTradeNo())
                .eqIfPresent(KeyboardTenantWithdrawOrderDO::getChannelRaw, reqVO.getChannelRaw())
                .eqIfPresent(KeyboardTenantWithdrawOrderDO::getBalanceTxnId, reqVO.getBalanceTxnId())
                .eqIfPresent(KeyboardTenantWithdrawOrderDO::getVersion, reqVO.getVersion())
                .eqIfPresent(KeyboardTenantWithdrawOrderDO::getCreatorId, reqVO.getCreatorId())
                .eqIfPresent(KeyboardTenantWithdrawOrderDO::getAuditorId, reqVO.getAuditorId())
                .eqIfPresent(KeyboardTenantWithdrawOrderDO::getPayerId, reqVO.getPayerId())
                .eqIfPresent(KeyboardTenantWithdrawOrderDO::getCreatedAt, reqVO.getCreatedAt())
                .eqIfPresent(KeyboardTenantWithdrawOrderDO::getUpdatedAt, reqVO.getUpdatedAt())
                .orderByDesc(KeyboardTenantWithdrawOrderDO::getId));
    }

}