package com.qmth.teachcloud.mark.mapper;

import java.util.List;

import com.qmth.teachcloud.mark.enums.MarkTaskStatus;
import org.apache.ibatis.annotations.Param;

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.DataPermissionRule;
import com.qmth.teachcloud.mark.dto.mark.manage.MarkManageDto;
import com.qmth.teachcloud.mark.dto.mark.manage.MarkerInfoDto;
import com.qmth.teachcloud.mark.entity.MarkTask;

/**
 * <p>
 * 评卷任务表 Mapper 接口
 * </p>
 *
 * @author xf
 * @since 2023-09-22
 */
public interface MarkTaskMapper extends BaseMapper<MarkTask> {

    IPage<MarkManageDto> listPaperManage(@Param("page") Page<MarkManageDto> page, @Param("examId") Long examId, @Param("courseCode") String courseCode, @Param("paperNumber") String paperNumber, @Param("progressStatus") Boolean progressStatus, @Param("dpr") DataPermissionRule dpr);

    List<MarkerInfoDto> listUserMarkedCount(@Param("examId") Long examId, @Param("courseCode") String courseCode, @Param("paperNumber") String paperNumber);

    MarkTask getLastOneByUserIdAndStatus(@Param("examId") Long examId, @Param("paperNumber") String paperNumber, @Param("groupNumber") Integer groupNumber, @Param("userId") Long userId, @Param("status") String status);

	IPage<MarkTask> listPageHistory(@Param("page")Page<MarkTask> page,@Param("userId") Long userId,@Param("examId") Long examId, @Param("paperNumber")String paperNumber,
			@Param("groupNumber")Integer groupNumber,@Param("secretNumber") String secretNumber,@Param("markerScore") Double markerScore);

	List<MarkTask> findUnMarked(@Param("page")Page<MarkTask> page,@Param("examId") Long examId, @Param("paperNumber")String paperNumber, @Param("groupNumber")Integer groupNumber,
			@Param("userId")Long userId);

	List<MarkTask> findUnMarkedFilterClass(@Param("page")Page<MarkTask> page,@Param("examId") Long examId, @Param("paperNumber")String paperNumber, @Param("groupNumber")Integer groupNumber,
			@Param("userId")Long userId);

    List<MarkTask> listByExamIdAndPaperNumberAndGroupNumberAndUserIdAndClassName(@Param("examId") Long examId, @Param("paperNumber") String paperNumber, @Param("groupNumber") Integer groupNumber, @Param("userId") Long userId, @Param("className") String className);

    int countByExamIdAndPaperNumberAndGroupNumberAndUserIdAndAndClassNameStatusIn(@Param("examId") Long examId, @Param("paperNumber") String paperNumber, @Param("groupNumber") Integer groupNumber, @Param("userId") Long userId, @Param("classNames") List<String> classNames, @Param("statusList") MarkTaskStatus[] statusList);
}
