package com.qmth.paper.library.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.paper.library.business.bean.result.ScanStatExportResult;
import com.qmth.paper.library.business.bean.result.ScanStatResult;
import com.qmth.paper.library.business.bean.result.TaskStudentResult;
import com.qmth.paper.library.business.entity.PaperLibrary;
import org.apache.ibatis.annotations.MapKey;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

/**
 * <p>
 * 图片库 Mapper 接口
 * </p>
 */
public interface PaperLibraryMapper extends BaseMapper<PaperLibrary> {

    int countScanStudentCount(@Param("paperScanTaskId") Long paperScanTaskId);

    IPage<TaskStudentResult> listByStudentCode(@Param("page") Page<TaskStudentResult> page, @Param("examId") Long examId, @Param("courseCode") String courseCode, @Param("studentCode") String studentCode);

    @MapKey(value = "studentId")
    List<Map> listMaxSequenceByPaperScanTaskId(@Param("paperScanTaskId") Long paperScanTaskId);

    IPage<ScanStatResult> listScanStat(@Param("page") Page<ScanStatResult> page, @Param("schoolId") Long schoolId, @Param("scanDate") String scanDate, @Param("userId") Long userId);

    int countScanStudentByScannerAndDate(@Param("schoolId") Long schoolId, @Param("createId") Long createId, @Param("scanDate") String scanDate);

    List<ScanStatExportResult> listScanStatExport(@Param("schoolId") Long schoolId, @Param("scanDateStr") String scanDateStr, @Param("userId") Long userId);

    List<String> listBatchNo(@Param("studentId") Long studentId);

    int getStudentMaxSequence(@Param("paperScanTaskId") Long paperScanTaskId,@Param("batchNo") String batchNo, @Param("studentId") Long studentId);
}
