package com.keao.edu.user.dao;

import com.keao.edu.common.dal.BaseDAO;
import com.keao.edu.user.dto.ExamRoomStudentRelationDto;
import com.keao.edu.user.api.entity.ExamRoomStudentRelation;
import org.apache.ibatis.annotations.Param;

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

public interface ExamRoomStudentRelationDao extends BaseDAO<Long, ExamRoomStudentRelation> {

    int batchInsert(@Param("roomStudents") List<ExamRoomStudentRelation> examRoomStudentRelations);

    /**
     * 开启/关闭教室
     * @param openFlag
     * @param examinationBasicId
     * @param studentId
     */
    void switchClassRoom(@Param("openFlag") Integer openFlag, @Param("examinationBasicId") Integer examinationBasicId, @Param("studentId") Integer studentId);

    List<ExamRoomStudentRelationDto> findExamRoomStudents(Map<String, Object> params);
    int countExamRoomStudents(Map<String, Object> params);

    /**
     * @describe 获取指定教室的学员
     * @author Joburgess
     * @date 2020.06.24
     * @param examRoomId:
     * @return java.util.List<com.keao.edu.user.api.entity.ExamRoomStudentRelation>
     */
    List<ExamRoomStudentRelation> findStudentsWithExamRoom(@Param("examRoomId") Long examRoomId);

    /**
     * @describe 删除指定教室的学员
     * @author Joburgess
     * @date 2020.06.24
     * @param examRoomId:
     * @param studentIds:
     * @return int
     */
    int deleteStudentsFromExamRoom(@Param("examRoomId") Long examRoomId,
                                    @Param("studentIds") List<Integer> studentIds);

    /**
     * @describe 根据班级删除记录
     * @author Joburgess
     * @date 2020.06.24
     * @param examRoomIds:
     * @return int
     */
    int deleteWithExamRooms(@Param("examRoomIds") List<Long> examRoomIds);

    /**
     * 获取教室学员关联
     * @param basicId
     * @param roomId
     * @param studentId
     * @return
     */
    ExamRoomStudentRelation getExamRoomStudentRelation(@Param("basicId") Integer basicId, @Param("roomId") String roomId, @Param("studentId") Integer studentId);

    /**
     * 获取教室学员关联
     * @param basicId
     * @param roomId
     * @param studentId
     * @return
     */
    List<ExamRoomStudentRelation> getExamRoomStudentRelations(@Param("basicId") Integer basicId, @Param("roomId") String roomId, @Param("studentId") Integer studentId);

}
