package com.m2pool.lease.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.m2pool.lease.dto.OrderStatusDto;
import com.m2pool.lease.dto.v2.OrderTimeInfoDto;
import com.m2pool.lease.entity.LeaseOrderItem;
import com.m2pool.lease.entity.LeasePaymentRecord;
import com.m2pool.lease.mq.message.RabbitmqPayAutoReturnInfoMessage;
import org.apache.ibatis.annotations.MapKey;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.transaction.Transaction;

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

/**
 * <p>
 * 订单明细表 Mapper 接口
 * </p>
 *
 * @author yyb
 * @since 2025-07-23
 */
@Mapper
public interface LeaseOrderItemMapper extends BaseMapper<LeaseOrderItem> {

    /**
     * 获取订单状态为支付中的订单机器id
     *
     * @param list
     * @return
     */
    List<Long> getMachineByOrderStatusIsPayInData(@Param("list") List<LeasePaymentRecord> list);

    /**
     *通过订单详情id找到订单id
     * @param orderItemIds
     * @return
     */
    List<Long> getOrderIds(@Param("orderItemIds") List<Long> orderItemIds);



    List<OrderStatusDto> getOrderInfoStatus(@Param("orderIds") List<Long> orderIds);



    /**
     * 通过订单详情id找到订单id
     * @param itemIds
     * @return
     */
    List<Long>  selectOrderInfoIds(@Param("itemIds") Set<Long> itemIds);


    /**
     * 获取需要更新已实际支付总金额的订单详情
     * @param address
     * @param transaction
     * @return
     */
   List<LeaseOrderItem> getNeedUpdateOrderItem(@Param("orderId") Long orderId);



   /**
    * 通过订单id找到订单详情
    * @param orderIds
    * @return
    */
    List<LeaseOrderItem> getOrderItemByOrderIds(@Param("orderIds") Set<Long> orderIds);


    /**
     * 获取订单详情id
     * @return
     */
    List<OrderTimeInfoDto> getOneDayApartOrder();


}
