package com.qs.mp.user.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.qs.mp.admin.domain.vo.UserExchangeOrderVO;
import com.qs.mp.user.domain.UserExchangeOrder;
import com.baomidou.mybatisplus.extension.service.IService;
import com.qs.mp.user.domain.vo.TicketHitPrizeBarrageVO;

import java.util.List;

/**
 * <p>
 * 用户盲豆兑换订单 服务类
 * </p>
 *
 * @author quanshu
 * @since 2022-03-07
 */
public interface IUserExchangeOrderService extends IService<UserExchangeOrder> {

  /**
   * 兑换
   * @param goodsId
   * @param skuId
   * @param orderNum
   * @return 余额不足返回false，其他抛异常
   */
  boolean exchange(Long userId, Long goodsId, Long skuId, int orderNum);

  /**
   * 根据条件获取用户兑奖记录列表
   * @param queryWrapper
   * @return
   */
  List<TicketHitPrizeBarrageVO> listByWrapper(QueryWrapper<TicketHitPrizeBarrageVO> queryWrapper);

  /**
   * 根据条件获取用户兑奖记录列表
   * @param queryWrapper  查询条件
   * @return
   */
  List<UserExchangeOrderVO> listUserExchangeOrderByWrapper(QueryWrapper<UserExchangeOrder> queryWrapper);

  /**
   * 根据条件统计用户兑奖记录数量
   * @param queryWrapper
   * @return
   */
  int countUserExchangeOrderByWrapper(QueryWrapper<UserExchangeOrder> queryWrapper);

}
