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.result.analyze.GradeBatchPaperResult;
import com.qmth.distributed.print.business.entity.GradeBatchPaper;
import org.apache.ibatis.annotations.Param;

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

/**
 * <p>
 * 分析-批次试卷关联关系表 Mapper 接口
 * </p>
 *
 * @author wangliang
 * @since 2022-05-20
 */
public interface GradeBatchPaperMapper extends BaseMapper<GradeBatchPaper> {

    /**
     * 查找分析批次下的试卷分页数据
     *
     * @param iPage      分页参数
     * @param batchId    批次id
     * @param examId     考试id
     * @param courseCode 课程编号
     * @param schoolId   学校id
     * @return 结果
     */
    IPage<GradeBatchPaperResult> findGradeBatchPaperPage(@Param("iPage") Page<GradeBatchPaperResult> iPage,
                                                         @Param("batchId") Long batchId,
                                                         @Param("examId") Long examId,
                                                         @Param("courseCode") String courseCode,
                                                         @Param("schoolId") Long schoolId);

    /**
     * 查询可以分析的试卷数据
     *
     * @param semesterId  学期id
     * @param examId      考试id
     * @param collegeId   开课学院id
     * @param courseCode  课程编号
     * @param teacherName 命题教师名称
     * @param orgIds      数据权限
     * @param schoolId    学校id
     * @return 查询结果
     */
    List<GradeBatchPaperResult> findAbleAnalyzePaper(@Param("semesterId") Long semesterId,
                                                     @Param("examId") Long examId,
                                                     @Param("collegeId") Long collegeId,
                                                     @Param("courseCode") String courseCode,
                                                     @Param("teacherName") String teacherName,
                                                     @Param("orgIds") Set<Long> orgIds,
                                                     @Param("schoolId") Long schoolId);


    GradeBatchPaper findByThirdExamIdAndGradeCourseCode(@Param("schoolId") Long schoolId, @Param("thirdExamId") String thirdExamId, @Param("gradeCourseCode") String gradeCourseCode);
}
