package com.qmth.themis.business.dao;

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

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.qmth.themis.business.bean.backend.ExamDeficiencyListBean;
import com.qmth.themis.business.bean.backend.ExamStudentLogListBean;
import com.qmth.themis.business.bean.backend.ExamViewCountListBean;
import com.qmth.themis.business.dto.response.RoomCodeQueryDto;
import com.qmth.themis.business.dto.response.TEExamStudentDto;
import com.qmth.themis.business.entity.TEExamStudent;

/**
 * @Description: 考生库 Mapper 接口
 * @Param:
 * @return:
 * @Author: wangliang
 * @Date: 2020/6/25
 */
@Mapper
public interface TEExamStudentMapper extends BaseMapper<TEExamStudent> {

    /**
     * 查询考生信息
     *
     * @param iPage
     * @param examId
     * @param activityId
     * @param identity
     * @param name
     * @param roomCode
     * @param courseCode
     * @param grade
     * @param enable
     * @param classNo
     * @return
     */
    public IPage<TEExamStudentDto> examStudentQuery(IPage<Map> iPage, @Param("examId") Long examId,
                                                    @Param("activityId") Long activityId, @Param("identity") String identity, @Param("name") String name,
                                                    @Param("roomCode") String roomCode, @Param("courseCode") String courseCode, @Param("grade") String grade,
                                                    @Param("enable") Integer enable, @Param("classNo") String classNo, @Param("hasPhoto")Integer hasPhoto);

    public List<Map<String, Object>> getTotalCount(@Param("examId") Long examId, @Param("activityId") Long activityId,
                                                   @Param("roomCode") String roomCode, @Param("courseCode") String courseCode);

    public IPage<ExamViewCountListBean> getTotalCountInfo(IPage<Map> iPage, @Param("examId") Long examId, @Param("activityId") Long activityId,
                                                          @Param("roomCode") String roomCode, @Param("courseCode") String courseCode);

    public List<Map<String, Object>> getDoneCountByActivityIds(@Param("examId") Long examId, @Param("activityIds") List<Long> activityIds);

    public List<Map<String, Object>> getAbsentCountByActivityIds(@Param("examId") Long examId, @Param("activityIds") List<Long> activityIds);

    /**
     * 考场查询
     *
     * @param roomName
     * @return
     */
    public List<RoomCodeQueryDto> examRoomQuery(@Param("roomName") String roomName);
    
    public IPage<ExamDeficiencyListBean> getExamDeficiencyPage(IPage<ExamDeficiencyListBean> iPage, @Param("examId") Long examId,
			@Param("activityId") Long activityId, @Param("roomCode") String roomCode,
			@Param("courseCode") String courseCode, @Param("name") String name, @Param("identity") String identity,@Param("activityIds") List<Long> activityIds);

    public IPage<ExamStudentLogListBean> getPageForStudentLog(IPage<ExamStudentLogListBean> iPage, @Param("examId") Long examId,
			@Param("activityId") Long activityId, @Param("roomCode") String roomCode,
			@Param("courseCode") String courseCode, @Param("name") String name, @Param("identity") String identity);

	
    public List<TEExamStudentDto> examStudentList(@Param("examId") Long examId,
            @Param("activityId") Long activityId, @Param("identity") String identity, @Param("name") String name,
            @Param("roomCode") String roomCode, @Param("courseCode") String courseCode, @Param("grade") String grade,
            @Param("enable") Integer enable, @Param("classNo") String classNo, @Param("hasPhoto")Integer hasPhoto);

	public void updateAlreadyExamCount(@Param("examStudentId")Long examStudentId,@Param("alreadyExamCount") Integer alreadyExamCount);

	public void updateCurrentRecordId(@Param("examStudentId")Long examStudentId,@Param("currentRecordId") Long currentRecordId);

}
