package com.qmth.distributed.print.business.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.qmth.distributed.print.business.bean.params.BasicExamStudentParam;
import com.qmth.distributed.print.business.bean.result.BasicExamStudentResult;
import com.qmth.teachcloud.common.entity.BasicExam;
import com.qmth.teachcloud.common.entity.BasicExamStudent;
import com.qmth.teachcloud.common.entity.SysUser;

import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;
import java.util.Map;

/**
 * <p>
 * 考生字典表 服务类
 * </p>
 *
 * @author CaoZixuan
 * @since 2024-02-22
 */
public interface BasicExamStudentService extends IService<BasicExamStudent> {

    /**
     * 分页查询
     *
     * @param semesterId      学期id
     * @param examId          考试id
     * @param courseCode      课程代码
     * @param teacher         教师
     * @param college         学院
     * @param major           专业
     * @param teachClazz      教学班
     * @param examStudentInfo 考生信息（姓名/学号）
     * @param pageNumber      分页页码
     * @param pageSize        分页数量
     * @return 查询结果
     */
    IPage<BasicExamStudentResult> page(Long semesterId, Long examId, String courseCode, String teacher,
                                       String college, String major, String teachClazz, String examStudentInfo, int pageNumber, int pageSize);

    /**
     * 列表查询
     *
     * @param requestUser     请求人
     * @param semesterId      学期id
     * @param examId          考试id
     * @param courseCode      课程代码
     * @param teacher         教师
     * @param college         学院
     * @param major           专业
     * @param teachClazz      教学班
     * @param examStudentInfo 考生信息（姓名/学号）
     * @return 查询结果
     */
    List<BasicExamStudentResult> list(SysUser requestUser, Long semesterId, Long examId, String courseCode, String teacher,
                                      String college, String major, String teachClazz, String examStudentInfo);

    /**
     * 新增编辑
     *
     * @param basicExamStudentParam 参数
     * @param requestUser           用户
     * @return id
     */
    Long save(BasicExamStudentParam basicExamStudentParam, SysUser requestUser);

    /**
     * 导入
     *
     * @param map 参数集
     */
    void buildImportObjects(Map<String, Object> map) throws IOException, NoSuchFieldException;

    /**
     * 导出
     *
     * @param response        response
     * @param semesterId      学期id
     * @param examId          考试id
     * @param courseCode      课程代码
     * @param teacher         教师
     * @param college         学院
     * @param major           专业
     * @param teachClazz      教学班
     * @param examStudentInfo 考生信息（姓名/学号）
     */
    void exportLogic(HttpServletResponse response, Long semesterId, Long examId, String courseCode, String teacher,
                     String college, String major, String teachClazz, String examStudentInfo) throws Exception;

    /**
     * 批量删除
     *
     * @param idList 要删除的考生字典id集合
     */
    void deleteBatch(List<Long> idList);

    /**
     * 构建考生字典对象
     *
     * @param basicExamStudentParam 考生字典参数
     * @param requestUser           请求人
     * @return 考生字典
     */
    BasicExamStudent editEntityHelp(BasicExamStudentParam basicExamStudentParam, BasicExam basicExam, List<String> oldPaperNumberList, SysUser requestUser);

    List<BasicExamStudent> listByExamIdAndPaperNumber(Long examId, String paperNumber);
}