package com.qmth.distributed.print.business.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.qmth.distributed.print.business.bean.dto.*;
import com.qmth.distributed.print.business.bean.result.ExaminationDetailResult;
import com.qmth.distributed.print.business.bean.result.ExaminationResult;
import com.qmth.distributed.print.business.entity.ExamDetail;
import com.qmth.distributed.print.business.entity.ExamDetailCourse;
import org.apache.ibatis.annotations.Param;

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

/**
 * <p>
 * 考务数据 Mapper 接口
 * </p>
 *
 * @author xf
 * @since 2021-03-23
 */
public interface ExamDetailMapper extends BaseMapper<ExamDetail> {

    IPage<PrintTaskDto> listPrintTask(Page<PrintTaskDto> page, @Param("schoolId") Long schoolId,
                                      @Param("printPlanId") Long printPlanId,
                                      @Param("status") String status,
                                      @Param("courseCode") String courseCode,
                                      @Param("paperNumber") String paperNumber,
                                      @Param("examPlace") String examPlace,
                                      @Param("examRoom") String examRoom,
                                      @Param("examStartTime") Long examStartTime,
                                      @Param("examEndTime") Long examEndTime,
                                      @Param("printStartTime") Long printStartTime,
                                      @Param("printEndTime") Long printEndTime,
                                      @Param("printHouseId") Long printHouseId,
                                      @Param("orgIds") Set<Long> orgIds);

    IPage<ExaminationResult> findBriefPage(@Param("page") Page<ExaminationResult> page,
                                           @Param("schoolId") Long schoolId,
                                           @Param("printPlanIdList") List<Long> printPlanIdList,
                                           @Param("courseCode") String courseCode,
                                           @Param("paperNumber") String paperNumber,
                                           @Param("examPlace") String examPlace,
                                           @Param("examRoom") String examRoom,
                                           @Param("packageCode") String packageCode,
                                           @Param("startDate") Long startDate,
                                           @Param("endDate") Long endDate,
                                           @Param("orgIds") Set<Long> orgIds);

    IPage<ExaminationDetailResult> findDetailPage(@Param("page") Page<ExaminationDetailResult> page,
                                                  @Param("schoolId") Long schoolId,
                                                  @Param("printPlanIdList") List<Long> printPlanIdList,
                                                  @Param("courseCode") String courseCode,
                                                  @Param("paperNumber") String paperNumber,
                                                  @Param("examPlace") String examPlace,
                                                  @Param("examRoom") String examRoom,
                                                  @Param("studentParams") String studentParams,
                                                  @Param("startDate") Long startDate,
                                                  @Param("endDate") Long endDate,
                                                  @Param("orgIds") Set<Long> orgIds);

    IPage<ExaminationDetailResult> findDetailPageById(@Param("page") Page<ExaminationDetailResult> page,
                                                      @Param("examDetailId") Long examDetailId);

    PrintTaskTotalDto taskTotalData(@Param("schoolId") Long schoolId,
                                    @Param("printPlanId") Long printPlanId,
                                    @Param("status") String status,
                                    @Param("courseCode") String courseCode,
                                    @Param("paperNumber") String paperNumber,
                                    @Param("examPlace") String examPlace,
                                    @Param("examRoom") String examRoom,
                                    @Param("examStartTime") Long examStartTime,
                                    @Param("examEndTime") Long examEndTime,
                                    @Param("printStartTime") Long printStartTime,
                                    @Param("printEndTime") Long printEndTime,
                                    @Param("printHouseId") Long printHouseId,
                                    @Param("orgIds") Set<Long> orgIds);

    IPage<ClientExamStudentDto> listClientExamStudentPage(Page<ClientExamStudentDto> page, @Param("schoolId") Long schoolId, @Param("examDetailId") Long examDetailId, @Param("ticketNumber") String ticketNumber, @Param("studentName") String studentName, @Param("courseCode") String courseCode);

    List<Map> listStudentByExamDetailCourseId(@Param("schoolId") Long schoolId, @Param("examDetailCourseId") Long examDetailCourseId, @Param("ticketNumber") String ticketNumber, @Param("type") String type);

    Integer selectPaperCount(@Param("schoolId") Long schoolId,
                             @Param("printPlanId") Long printPlanId,
                             @Param("status") String status,
                             @Param("courseCode") String courseCode,
                             @Param("paperNumber") String paperNumber,
                             @Param("examPlace") String examPlace,
                             @Param("examRoom") String examRoom,
                             @Param("examStartTime") Long examStartTime,
                             @Param("examEndTime") Long examEndTime,
                             @Param("printHouseId") Long printHouseId,
                             @Param("orgIds") Set<Long> orgIds);

    List<ExamDetailCourse> listSyncPaperNumberByPrintPlanId(Long printPlanId);
}
