package com.qmth.teachcloud.mark.mapper;

import java.util.List;

import com.qmth.teachcloud.common.entity.BasicTeachClazz;
import io.swagger.models.auth.In;
import org.apache.ibatis.annotations.Param;

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.teachcloud.common.bean.dto.DataPermissionRule;
import com.qmth.teachcloud.mark.bean.archivescore.*;
import com.qmth.teachcloud.mark.bean.scananswer.AnswerQueryDomain;
import com.qmth.teachcloud.mark.bean.scananswer.AnswerQueryVo;
import com.qmth.teachcloud.mark.bean.student.StudentQuery;
import com.qmth.teachcloud.mark.bean.student.StudentVo;
import com.qmth.teachcloud.mark.dto.UnexistStudentDto;
import com.qmth.teachcloud.mark.dto.mark.score.StudentScoreDetailDto;
import com.qmth.teachcloud.mark.entity.MarkStudent;

/**
 * <p>
 * 考试考生库 Mapper 接口
 * </p>
 *
 * @author xf
 * @since 2023-09-22
 */
public interface MarkStudentMapper extends BaseMapper<MarkStudent> {

	IPage<StudentScoreDetailDto> pageStudentScore(@Param("page") Page<StudentScoreDetailDto> page, @Param("examId") Long examId, @Param("paperNumber") String paperNumber, @Param("college") String college,
			@Param("majorName") String majorName, @Param("className") String className, @Param("teacher") String teacher, @Param("filter") Integer filter,
			@Param("status") String status, @Param("breach") Boolean breach, @Param("startScore") Double startScore, @Param("endScore") Double endScore,
			@Param("subjectiveStartScore") Double subjectiveStartScore, @Param("subjectiveEndScore") Double subjectiveEndScore,
			@Param("objectiveStartScore") Double objectiveStartScore,
			@Param("objectiveEndScore") Double objectiveEndScore, @Param("subScore") Double subScore, @Param("objectiveScoreLt") Double objectiveScoreLt,
			@Param("studentName") String studentName, @Param("studentCode") String studentCode, @Param("orderType") String orderType,
			@Param("orderField") String orderField);

	List<MarkStudent> listAbsentOrBreachMarkTaskStudent(@Param("examId") Long examId,
			@Param("paperNumber") String paperNumber);

	IPage<MarkStudent> listUnMarkTaskStudent(@Param("page") Page<MarkStudent> page, @Param("examId") Long examId,
			@Param("paperNumber") String paperNumber, @Param("groupNumber") Integer groupNumber);

	StudentVo findOne(@Param("query") StudentQuery query);

	IPage<AnswerQueryVo> queryPage(Page<AnswerQueryVo> page, @Param("query") AnswerQueryDomain query, @Param("dpr") DataPermissionRule dpr);

	List<String> querySummary(@Param("query") AnswerQueryDomain query, @Param("dpr") DataPermissionRule dpr);

	List<Long> findIdByExamIdAndPaperNumber(@Param("examId") Long examId, @Param("paperNumber") String paperNumber);

	List<ArchiveStudentVo> studentList(@Param("schoolId") Long schoolId, @Param("req") ArchiveStudentQuery query, @Param("dpr") DataPermissionRule dpr);

	OverViewVo overview(@Param("schoolId") Long schoolId, @Param("req") ArchiveStudentQuery query, @Param("dpr") DataPermissionRule dpr);

	int getCountByScoreRange(@Param("examId") Long examId, @Param("paperNumber") String paperNumber,
			@Param("start") Double start, @Param("end") Double end);

	List<CollegeVo> college(@Param("schoolId") Long schoolId, @Param("req") ArchiveStudentQuery query, @Param("dpr") DataPermissionRule dpr);

	List<ClassVo> classData(@Param("schoolId") Long schoolId, @Param("req") ArchiveStudentQuery query, @Param("dpr") DataPermissionRule dpr);

	List<TeacherVo> teacher(@Param("schoolId") Long schoolId, @Param("req") ArchiveStudentQuery query, @Param("dpr") DataPermissionRule dpr);

	List<UnexistStudentDto> listUnexistStudentByExamIdAndCoursePaperId(@Param("examId") Long examId, @Param("courseCode") String courseCode, @Param("coursePaperId") String coursePaperId,
			@Param("status") String status, @Param("dpr") DataPermissionRule dpr);

	IPage<ArchiveStudentVo> studentList(@Param("page") Page<ArchiveStudentVo> page, @Param("schoolId") Long schoolId, @Param("req") ArchiveStudentQuery query, @Param("dpr") DataPermissionRule dpr);

	List<TeacherClassVo> teacherClass(@Param("schoolId") Long schoolId, @Param("req") ArchiveStudentQuery query, @Param("dpr") DataPermissionRule dpr);

	int selectCountByQuery(@Param("markStudent") MarkStudent markStudent, @Param("dpr") DataPermissionRule dpr);

	int countAssigned(@Param("markStudent") MarkStudent markStudent, @Param("dpr") DataPermissionRule dpr);

	List<MarkStudent> listScanCollegeByExamIdAndCourseCodeAndCoursePaperId(@Param("examId") Long examId, @Param("courseCode") String courseCode, @Param("coursePaperId") String coursePaperId,
			@Param("status") String status, @Param("dpr") DataPermissionRule dpr);

	BasicTeachClazz getBasicTeachClazzById(Long clazzId);

    Integer maxCardNumber(@Param("examId") Long examId, @Param("paperNumber") String paperNumber, @Param("paperType") String paperType);
}
