package com.yida.data.school.health.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.yida.data.common.core.entity.health.EduStudentPhysicalExaminationGradeResults;
import com.yida.data.common.core.entity.health.EduStudentProjectTestResult;
import com.yida.data.school.vo.health.*;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * 学生单项成绩记录表 Mapper
 *
 * @author wjm
 * @date 2021-09-14 17:16:24
 */
public interface EduStudentProjectTestResultMapper extends BaseMapper<EduStudentProjectTestResult> {

    /**
     * 查询自测列表数据
     * @param stuSex
     * @param recordGradeId
     * @return
     */
    List<EduProjectVO> findStuSelfTestProjectList(@Param("stuSex") String stuSex, @Param("recordGradeId") Long recordGradeId);

    /**
     * 查询国标测试数据
     * @param id
     * @return
     */
    EduNationalProjectVO findStuNationalTest(@Param("id") Long id);

    /**
     * 学生主键id和项目id查询项目成绩列表数据
     * @param projectId
     * @param stuId
     * @return
     */
    List<EduSingleProjectVO> findStuResultsList(@Param("projectId") Long projectId, @Param("stuId") Long stuId);

    Integer getAddScoreNum(@Param("id") Long id);

    Integer getFailNum(@Param("id") Long id);

    /**
     * 查询国标成绩
     * @param studentId
     */
    EduStudentNationalVO findStuNational(@Param("studentId") Long studentId);

    /**
     * 查询自测成绩
     * @param studentId
     */
    EduStudentSelfVO findStuSelfTest(@Param("studentId") Long studentId);

    /**
     * 查询学校所有学生成绩
     * @param schoolId
     * @param page
     * @return
     */
    IPage<EduNationalProjectVO> findPageStuSelfTestProjectList(@Param("page") Page<EduNationalProjectVO> page, @Param("schoolId") Long schoolId);

    List<EduSingleProjectVO> findStudentResult(@Param("id") Long id);

    /**
     * 条件查询
     * @param page
     * @param schoolId
     * @param groupId
     * @param gradeId
     * @param classId
     * @param studentName
     * @param type
     * @return
     */
    IPage<StudentHealthListVO> findPageStudent(@Param("page") Page<EduNationalProjectVO> page,
                                               @Param("schoolId") Long schoolId, @Param("groupId")Long groupId, @Param("gradeId") Long gradeId,
                                               @Param("classId") Long classId, @Param("studentName") String studentName, @Param("type") Integer type);


    List<EduStudentPhysicalExaminationGradeResults> selectStudentList(@Param("studentId") String studentId);

    List<EduNationalProjectVO> allRecord(@Param("studentId") Long studentId);

    /**
     * 查询测试对应所有测试数据
     * @param id
     * @return
     */
    List<EduSingleProjectVO> findAllTest(@Param("id") Long id);


    /**
     * 查询近5次测试的所有数据
     * @param resultId
     * @return
     */
    List<EduSingleProjectVO> findAllResult(@Param("studentId") Long resultId);

    /**
     * 查询学生历史成绩
     * @param studentId
     * @return
     */
    List<AppHistoryHealthVO> findStudentHistoryResults(@Param("studentId") Long studentId);

    /**
     * 查询左右眼视力列表
     * @param studentId
     * @param projectId
     * @param num
     * @return
     */
    List<EyeResultVO> findLastEyesTest(@Param("studentId") Long studentId, @Param("projectId") Integer projectId, @Param("num") Integer num);

    EduNationalProjectVO findOneStuSelfTestProject(@Param("gradeResultId") Long gradeResultId);

    List<EyeResultVO> findEyesTest(@Param("studentId") Long studentId, @Param("i") int i);
}
