package com.jeeplus.pubmodules.luckyDraw.mapper;

import com.baomidou.mybatisplus.annotation.InterceptorIgnore;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.jeeplus.pubmodules.luckyDraw.domain.LuckyDrawInfo;
import com.jeeplus.pubmodules.luckyDraw.service.dto.LuckyDrawInfoDto;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * @author: 王强
 * @create: 2023-02-28 11:01
 **/
@Mapper
@InterceptorIgnore(tenantLine = "true")
public interface LuckyDrawInfoMapper extends BaseMapper<LuckyDrawInfo> {

    IPage<LuckyDrawInfoDto> findList(Page<LuckyDrawInfoDto> page, @Param(Constants.WRAPPER) QueryWrapper<LuckyDrawInfoDto> queryWrapper);

    /**
     * 根据活动id查询抽奖信息
     * @param id
     * @return
     */
    LuckyDrawInfoDto findByEventId(String id);

    /**
     * 根据奖品数量随机抽取对应的用户
     * @return
     */
    List<String> selectUserId(@Param("number") int number,
                              @Param("eventId") String eventId);

    /**
     * 根据活动id和奖项id对该奖项数据信息进行删除
     * @param info
     * @return
     */
    void deleteByEventIdAndAwardId(LuckyDrawInfoDto info);

    Integer getLuckyDrawUserCount(String eventId);

    Integer getLuckyDrawMemberCount(String eventId);
}
