package com.keao.edu.user.dao;


import com.keao.edu.common.dal.BaseDAO;
import com.keao.edu.user.dto.*;
import com.keao.edu.user.entity.ExamRegistration;
import com.keao.edu.user.enums.StudentRegistrationStatusEnum;
import org.apache.ibatis.annotations.Param;

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

public interface ExamRegistrationDao extends BaseDAO<Long, ExamRegistration> {

    List<ExamRegistrationRoomDto> queryExamRegist(Map<String, Object> params);

    int countExamRegist(Map<String, Object> params);

    int batchUpdate(@Param("regists") List<ExamRegistration> regists);

    /**
     * @param organIds:
     * @return int
     * @describe 统计无教室学员
     * @author Joburgess
     * @date 2020.06.29
     */
    int countWithoutExamRoomStudentNum(@Param("organIds") List<Integer> organIds,
                                       @Param("examId") Integer examId);

    /**
     * @param organIds:
     * @param examId:
     * @return int
     * @describe 统计已分配教室学员数量
     * @author Joburgess
     * @date 2020.06.30
     */
    int countInExamRoomStudentNum(@Param("organIds") List<Integer> organIds,
                                  @Param("examId") Long examId);

    /**
     * @param organIds:
     * @param examId:
     * @return int
     * @describe 统计总报名人数
     * @author Joburgess
     * @date 2020.06.30
     */
    int countTotalRegistrationStudentNumWithExam(@Param("organIds") List<Integer> organIds,
                                                 @Param("examId") Long examId);

    /**
     * @param selfOrganId: 本级合作单位编号
     * @param organIds:    本级及子级合作单位编号
     * @param examId:      考级项目编号
     * @return com.keao.edu.user.dto.ExamRegistrationStatisticsDto
     * @describe 统计招生信息
     * @author Joburgess
     * @date 2020.06.30
     */
    ExamRegistrationStatisticsDto getExamRegistrationStaticsInfo(@Param("selfOrganId") Integer selfOrganId,
                                                                 @Param("organIds") List<Integer> organIds,
                                                                 @Param("examId") Integer examId);

    /**
     * @param examId:
     * @param studentIds:
     * @return java.util.List<com.keao.edu.user.entity.ExamRegistration>
     * @describe 获取指定考级项目下指定学员的报名记录
     * @author Joburgess
     * @date 2020.07.02
     */
    List<ExamRegistration> getWithExamAndStudents(@Param("examId") Long examId,
                                                  @Param("studentIds") List<Integer> studentIds);

    /**
     * @param registIds:
     * @return java.util.List<com.keao.edu.user.entity.ExamRegistration>
     * @describe 获取指定报名记录
     * @author Joburgess
     * @date 2020.07.12
     */
    List<ExamRegistration> getRegists(@Param("registIds") List<Long> registIds);

    /**
     * COUNT学员报考记录
     *
     * @param params
     * @return
     */
    int countStudentList(Map<String, Object> params);

    /**
     * 获取学员报考列表
     *
     * @param params
     * @return
     */
    List<ExamRegistrationDto> queryStudentList(Map<String, Object> params);

    /**
     * 学员考试记录
     *
     * @param params
     * @return
     */
    List<StudentExamListDto> queryExamList(Map<String, Object> params);

    /**
     * @param params
     * @return
     */
    int countExamList(Map<String, Object> params);


    /**
     * 获取报名信息
     *
     * @return
     */
    ExamRegistrationDto getExamRegistration(@Param("examRegistrationId") Long examRegistrationId);

    /**
     * 获取单条报名信息
     *
     * @param id
     * @return
     */
    ExamRegistration getExamRegistrationInfo(@Param("id") Integer id);

    /**
     * 根据考试项目id专业id和等级获取已报名的信息
     *
     * @param examId
     * @param subjectId
     * @param level
     * @return
     */
    ExamRegistration getRegistration(@Param("examId") Long examId, @Param("studentId") Integer studentId,
                                     @Param("subjectId") Integer subjectId, @Param("level") Integer level,
                                     @Param("statusEnumList") List<StudentRegistrationStatusEnum> statusEnumList);

    /**
     * 获取学员机构列表
     * @param userId
     * @return
     */
    List<Integer> queryStudentTenantId(Integer userId);

    /**
     * 学生端考级曲库考试列表
     * @param params
     * @return
     */
    int countStudentBaseExams(Map<String, Object> params);

    /**
     * 学生端考级曲库考试列表
     * @param params
     * @return
     */
    List<StudentBaseExamsDto> queryStudentBaseExams(Map<String, Object> params);

    /**
     * 学生端录播详情页面
     * @param examRegistrationId
     * @return
     */
    StuRecordDetailDto getStuRecordDetail(Long examRegistrationId);
}
