package com.qmth.themis.business.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.qmth.themis.business.bean.admin.OpenExamBean;
import com.qmth.themis.business.bean.result.VideoQueryResult;
import com.qmth.themis.business.dto.response.TEExamQueryDto;
import com.qmth.themis.business.dto.response.TEExamWaitDto;
import com.qmth.themis.business.entity.TEExam;
import com.qmth.themis.business.enums.InvigilateMonitorStatusEnum;
import com.qmth.themis.business.enums.ScoreStatusEnum;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

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

/**
 * @Description: 考试批次 Mapper 接口
 * @Param:
 * @return:
 * @Author: wangliang
 * @Date: 2020/6/25
 */
@Mapper
public interface TEExamMapper extends BaseMapper<TEExam> {

    /**
     * 查询考试批次
     *
     * @param iPage
     * @param userId
     * @param id
     * @param code
     * @param name
     * @param mode
     * @param enable
     * @param orgId
     * @param type
     * @param finished
     * @return
     */
    public IPage<TEExamQueryDto> examQuery(IPage<Map> iPage, @Param("userId") Long userId, @Param("id") Long id, @Param("code") String code, @Param("name") String name, @Param("mode") String mode, @Param("enable") Integer enable, @Param("orgId") Long orgId, @Param("type") String type, @Param("finished") Boolean finished);

    /**
     * 根据考试批次编码查询考场接口
     *
     * @param code
     * @return
     */
    @SuppressWarnings("MybatisXMapperMethodInspection")
    public List<Map> examroomQuery(@Param("code") String code);

    /**
     * 获取考试待考列表
     *
     * @param studentId
     * @param examId
     * @param orgId
     * @return
     */
    public List<TEExamWaitDto> getWaitingExam(@Param("studentId") Long studentId, @Param("examId") Long examId, @Param("orgId") Long orgId);

    /**
     * 监考端获取考试批次列表
     *
     * @param userId
     * @param orgId
     * @return
     */
    @SuppressWarnings("MybatisXMapperMethodInspection")
    public List<Map> examList(@Param("userId") Long userId, @Param("orgId") Long orgId);

    /**
     * 考试批次权限过滤
     *
     * @param userId
     * @param orgId
     * @param type
     * @return
     */
    public List<TEExam> examPrivilegeQuery(@Param("userId") Long userId, @Param("orgId") Long orgId, @Param("type") String type);

    public void updateInvigilateMonitorStatus(@Param("monitorStatus") InvigilateMonitorStatusEnum monitorStatus, @Param("examId") Long examId);

    public void updateScoreStatus(@Param("scoreStatus") ScoreStatusEnum scoreStatus, @Param("examId") Long examId);

    public void updateScoreProgress(@Param("progress") Double progress, @Param("examId") Long examId);

    public IPage<OpenExamBean> examQueryForOpen(IPage<OpenExamBean> iPage, @Param("id") Long id, @Param("code") String code);

    /**
     * 视频存储查询接口
     *
     * @param iPage
     * @param examName
     * @param orgName
     * @param type
     * @return
     */
    public IPage<VideoQueryResult> videoQuery(IPage<Map> iPage, @Param("examName") String examName, @Param("orgName") String orgName, @Param("type") String type);
}