package com.yonge.cooleshow.biz.dal.dao;

import java.util.List;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;

import com.yonge.cooleshow.biz.dal.enums.activity.ActivityRankingRuleEnum;
import org.apache.ibatis.annotations.Param;

import com.yonge.cooleshow.biz.dal.entity.ActivityEvaluationRecord;
import com.yonge.cooleshow.biz.dal.vo.ActivityEvaluationRecordVo;
import com.yonge.cooleshow.biz.dal.vo.ActivityRankingVo;
import com.yonge.cooleshow.biz.dal.dto.search.ActivityEvaluationRecordSearch;


public interface ActivityEvaluationRecordDao extends BaseMapper<ActivityEvaluationRecord>{
	/**
	 * 查询详情
     * @author liweifan
     * @date 2022-08-04 10:19:49
     * @return: com.yonge.cooleshow.biz.dal.vo.ActivityEvaluationRecordVo
	 */
	ActivityEvaluationRecordVo detail(@Param("id") Long id);

	/**
	 * 分页查询
     * @author liweifan
     * @date 2022-08-04 10:19:49
     * @return: com.yonge.cooleshow.biz.dal.vo.ActivityEvaluationRecordVo
	 */
	List<ActivityEvaluationRecordVo> selectPage(@Param("page") IPage page, @Param("param") ActivityEvaluationRecordSearch activityEvaluationRecord);

	/**
	 * 获取参与 的活动项目id集合
	 *
	 * @param userId     用户id
	 * @param activityId 活动id
	 * @return
	 */
    List<Long> getJoinEvaluationIdList(@Param("activityId") Long activityId, @Param("userId") Long userId);

	/**
	 * 查询指定活动指定曲目的排行榜
	 *
	 * @param activityPlanId       指定活动
	 * @param activityEvaluationId 指定曲目
	 * @param limit                获奖人数
	 * @param rankingRule
	 * @return
	 */
	List<ActivityRankingVo> queryRankingList(@Param("activityPlanId") Long activityPlanId, @Param(
			"activityEvaluationId") Long activityEvaluationId, @Param("limit") int limit, @Param(
			"rankRule") ActivityRankingRuleEnum rankingRule);

	ActivityRankingVo queryUserRanking(@Param("activityPlanId") Long activityPlanId, @Param(
			"activityEvaluationId") Long activityEvaluationId, @Param("userId") Long userId, @Param(
			"rankRule") ActivityRankingRuleEnum rankRule);
	
	ActivityEvaluationRecord queryLastestRecord(@Param("activityPlanId") Long activityPlanId, @Param("userId") Long userId);

	/**
	 * 用户活动最高排名信息
	 *
	 * @param userIds     用户ID
	 * @param rankingRule
	 * @return List<ActivityEvaluationRecord>
	 */
	List<ActivityEvaluationRecord> selectUserHighestRankingInfo(@Param("activityId") Long activityId, @Param(
			"userIds") List<Long> userIds, @Param("rankRule") ActivityRankingRuleEnum rankingRule);
}