package com.m2pool.lease.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.m2pool.lease.dto.*;
import com.m2pool.lease.entity.LeasePayRecordMessage;
import com.m2pool.lease.entity.LeaseShopConfig;
import com.m2pool.lease.entity.LeaseUserWalletData;
import org.apache.ibatis.annotations.MapKey;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;
import java.util.Set;

/**
 * <p>
 * LeasePayRecordMessageMapper 接口
 * </p>
 *
 * @author yyb
 * @since 2025-09-10
 */
@Mapper
public interface LeasePayRecordMessageMapper extends BaseMapper<LeasePayRecordMessage> {
    /**
     * 检查用户半年内是否有支付操作
     * @param fromAddress
     * @return
     */
    boolean checkPayOperator(@Param("fromAddress") String  fromAddress);


    /**
     * 检查用户批量是否有支付操作
     * @param fromAddressList
     * @return
     */
    @MapKey("fromAddress")
    Map<String, CheckAddressDto> checkPayOperatorBatch(@Param("list") List<LeaseUserWalletData> fromAddressList);

    /**
     * 批量查询用户余额支付列表
     * @param walletList
     * @param status
     * @return
     */

    List<PayRecordMessageDto> balancePayList(@Param("walletList") List<LeaseShopConfig> walletList, @Param("status") Integer  status);

    /**
     * 交易流水---支付
     * @param walletList
     * @return
     */
    List<TransactionRecordDto> transactionRecord(@Param("walletList") List<LeaseUserWalletData> walletList);


    /**
     * 最近交易
     * @param walletList
     * @return
     */
    List<RecentlyTransactionDto> getRecentlyTransaction(@Param("walletList") List<LeaseUserWalletData> walletList);


    /**
     * 保存或者更新根据txHash
     * @param leasePayRecordMessage
     * @return
     */
   int updateByTxHash(@Param("leasePayRecordMessage") LeasePayRecordMessage leasePayRecordMessage,@Param("txHash") String txHash);

   /**
     * 根据订单id获取队列id
     * @param infoIds
     * @return
     */
    @MapKey("orderId")
    Map<Long,LeasePayRecordMessage> getQueueIdByInfoIds(@Param("infoIds") List<Long> infoIds);

}
