package com.qmth.teachcloud.common.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.teachcloud.common.bean.dto.BasicStudentExportDto;
import com.qmth.teachcloud.common.bean.dto.DataPermissionRule;
import com.qmth.teachcloud.common.bean.dto.TaskPrintClassDto;
import com.qmth.teachcloud.common.bean.result.BasicExamStudentResult;
import com.qmth.teachcloud.common.entity.BasicStudent;
import org.apache.ibatis.annotations.Param;

import java.util.List;

import java.util.Set;

/**
 * <p>
 * 学校id Mapper 接口
 * </p>
 *
 * @author wangliang
 * @since 2021-08-02
 */
public interface BasicStudentMapper extends BaseMapper<BasicStudent> {

    List<TaskPrintClassDto> listByClass(@Param("schoolId") Long schoolId, @Param("stringList") Set<String> stringList);

    IPage<BasicExamStudentResult> findBasicStudentPage(@Param("iPage") Page<BasicExamStudentResult> iPage,
                                                       @Param("queryParams") String queryParams,
                                                       @Param("schoolId") Long schoolId,
                                                       @Param("collegeId") Long collegeId,
                                                       @Param("majorId") Long majorId,
                                                       @Param("clazzId") Long clazzId,
                                                       @Param("dpr") DataPermissionRule dpr);

    /**
     * 根据基础学生主键同步删除教学学生信息
     *
     * @param idSet 基础学生id集合
     * @return 删除的行数
     */
    int deleteTeachStudentByBasicStudentIdSet(@Param("idSet") Set<Long> idSet);

    /**
     * 根据id查找学生信息
     *
     * @param id id
     * @return 结果
     */
    BasicExamStudentResult findById(@Param("id") Long id);

    /**
     * 根据第三方字典id查找学生集合
     *
     * @param schoolId        学校id
     * @param teacher
     * @param className
     * @param studentCodeList 学号集合
     * @return 学生查询结果
     */
    List<BasicExamStudentResult> findBasicStudentList(@Param("schoolId") Long schoolId,
                                                      @Param("examId") Long examId,
                                                      @Param("courseCode") String courseCode,
                                                      @Param("teacher") String teacher,
                                                      @Param("className") String className,
                                                      @Param("studentCodeList") List<String> studentCodeList);

    List<BasicStudentExportDto> listExportData(@Param("queryParams") String queryParams,
                                               @Param("schoolId") Long schoolId,
                                               @Param("collegeId") Long collegeId,
                                               @Param("majorId") Long majorId,
                                               @Param("clazzIdList") Set<Long> clazzIdList,
                                               @Param("dpr") DataPermissionRule dpr);
}
