package com.qmth.teachcloud.report.business.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.qmth.teachcloud.report.business.bean.dto.AnswerDetailBean;
import com.qmth.teachcloud.report.business.bean.dto.query.BasicAnswerDto;
import com.qmth.teachcloud.report.business.bean.dto.query.ValidAnswerDetailDto;
import com.qmth.teachcloud.report.business.bean.result.TBAnswerResult;
import com.qmth.teachcloud.report.business.entity.TBAnswer;
import org.apache.ibatis.annotations.Param;

import java.util.LinkedList;
import java.util.List;

/**
 * <p>
 * 基础考生作答记录详情表 Mapper 接口
 * </p>
 *
 * @author wangliang
 * @since 2021-06-01
 */
public interface TBAnswerMapper extends BaseMapper<TBAnswer> {

    /**
     * 根据试卷id查找考该试卷的所有考生作答记录详情
     *
     * @param paperId 试卷id
     * @return 作答记录数据
     */
    List<BasicAnswerDto> findByPaperId(@Param("paperId") Long paperId);

    /**
     * 查找试卷结构效度数据
     *
     * @param examId     考试id
     * @param courseCode 课程编号
     * @return 结果
     */
    List<ValidAnswerDetailDto> findValid(@Param("examId") Long examId, @Param("courseCode") String courseCode);

    /**
     * 查找有效答案
     *
     * @param examId
     * @param courseCode
     * @return
     */
    List<TBAnswerResult> findValidAnswerDetail(@Param("examId") Long examId, @Param("courseCode") String courseCode);

    /**
     * 查找实际参加考试的详细作答记录
     *
     * @param examId  考试id
     * @param courseCode  课程编号
     * @return 键值对
     */
    LinkedList<AnswerDetailBean> findValidAnswerDetailWithPap(@Param("examId") Long examId, @Param("courseCode") String courseCode);
}
