package com.yida.data.school.exam.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yida.data.common.core.entity.exam.CoreExaminationPublishRecord;
import com.yida.data.common.core.entity.exam.CoreExaminationStudentCourse;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

@Mapper
public interface CoreExaminationStudentCourseMapper extends BaseMapper<CoreExaminationStudentCourse> {

    /**
     * 根据考试主键id查询学生科目成绩（发布后）
     *
     * @param coreExaminationId
     * @return
     * @Author: ZYJ
     * @Date: 2020/6/22 13:35
     */
    List<CoreExaminationPublishRecord> findByCoreExaminationId(Long coreExaminationId);

    /**
     * @return java.util.List<com.yida.data.entity.CoreExaminationStudentCourse>
     * 根据考生查询出对应的成绩
     * @Author WSJ
     * @Date 15:58 2020/6/29
     * @Param [coreExaminationStudentId]
     **/
    List<CoreExaminationStudentCourse> findByCoreExaminationStudentId(Integer coreExaminationStudentId);

    /**
     * @return java.util.List<com.yida.data.entity.CoreExaminationPublishRecord>
     * 根据考场,年级id,科目id查询对应的所有成绩并返回排序
     * @Author WSJ
     * @Date 15:00 2020/6/29
     * @Param [coreExaminationPublishRecord]
     **/
    List<CoreExaminationStudentCourse> findByCoreExaminationIdAndGradeIdCourseId(@Param("examId") Long examId,
                                                                                 @Param("gradeId") Long gradeId,
                                                                                 @Param("courseId") Long courseId);


    /**
     * @return java.util.List<com.yida.data.entity.CoreExaminationStudentCourse>\
     * 根据考场,年级id,班级id，科目id查询对应的所有成绩并返回排序
     * @Author WSJ
     * @Date 15:10 2020/6/29
     * @Param [coreExaminationStudentCourse]
     **/
    List<CoreExaminationStudentCourse> findByCoreExaminationIdAndGradeIdClassIdCourseId(@Param("examId") Long examId,
                                                                                        @Param("gradeId") Long gradeId,
                                                                                        @Param("classId") Long classId,
                                                                                        @Param("courseId") Long courseId);

    /**
     * @return void
     * 更新年级排名或班级排名
     * @Author WSJ
     * @Date 14:08 2020/6/29
     * @Param [coreExaminationStudentCourses]
     **/
    void updateGradleRankOrClassRank(CoreExaminationStudentCourse coreExaminationStudentCourses);

    /**
     * @return com.yida.data.entity.CoreExaminationStudentCourse
     * 根据id查询
     * @Author WSJ
     * @Date 15:01 2020/6/30
     * @Param [coreExaminationStudentCourse]
     **/
    CoreExaminationStudentCourse findById(CoreExaminationStudentCourse coreExaminationStudentCourse);

}