package com.qmth.distributed.print.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.distributed.print.business.bean.dto.ExamTaskPlanStatisticDto;
import com.qmth.distributed.print.business.bean.dto.TCStatisticsDto;
import com.qmth.distributed.print.business.bean.result.TCStatisticResult;
import com.qmth.distributed.print.business.bean.result.TeachCourseResult;
import com.qmth.distributed.print.business.entity.TCStatistics;
import com.qmth.distributed.print.business.enums.StatisticsStatusEnum;
import org.apache.ibatis.annotations.Param;

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

/**
 * <p>
 * 命题统计表 Mapper 接口
 * </p>
 *
 * @author wangliang
 * @since 2021-09-09
 */
public interface TCStatisticsMapper extends BaseMapper<TCStatistics> {

    /**
     * 查找印刷计划信息
     *
     * @param iPage
     * @param collegeId
     * @param teachingRoomId
     * @param status
     * @param courseName
     * @param teacherName
     * @param schoolId
     * @param userId
     * @return
     */
    @Deprecated
    public IPage<TCStatisticsDto> list(IPage<Map> iPage,
                                       @Param("semesterId") Long semesterId,
                                       @Param("examId") Long examId,
                                       @Param("collegeId") Long collegeId,
                                       @Param("teachingRoomId") Long teachingRoomId,
                                       @Param("status") String status,
                                       @Param("courseName") String courseName,
                                       @Param("teacherName") String teacherName,
                                       @Param("schoolId") Long schoolId,
                                       @Param("userId") Long userId);

    /**
     * 查询命题计划统计表
     *
     * @param iPage          分页参数
     * @param semesterId     学期id
     * @param examId         考试id
     * @param collegeId      学院id
     * @param teachingRoomId 教研室id
     * @param status         状态
     * @param courseName     课程名称
     * @param teacherName    任课教师名称
     * @param userId         用户
     * @return 查询结果
     */
    public IPage<TCStatisticResult> findExamTaskPrintStatistic(@Param("iPage") Page<TCStatisticResult> iPage,
                                                               @Param("semesterId") Long semesterId,
                                                               @Param("examId") Long examId,
                                                               @Param("collegeId") Long collegeId,
                                                               @Param("teachingRoomId") Long teachingRoomId,
                                                               @Param("status") StatisticsStatusEnum status,
                                                               @Param("courseName") String courseName,
                                                               @Param("teacherName") String teacherName,
                                                               @Param("userId") Long userId);


    /**
     * 根据batchNo统计信息
     *
     * @param schoolId
     * @param batchNo
     * @param orgIds
     * @return
     */
    public List<TCStatisticsDto> findByBatchNoCount(@Param("schoolId") Long schoolId, @Param("batchNo") String batchNo, @Param("orgIds") Set<Long> orgIds);

    /**
     * 根据batchNo统计信息
     *
     * @param schoolId
     * @param batchNo
     * @param orgIds
     * @return
     */
    public List<TCStatisticsDto> findByBatchNoCountJoin(@Param("schoolId") Long schoolId, @Param("batchNo") String batchNo, @Param("orgIds") Set<Long> orgIds);

    /**
     * 根据考试id和课程编号查询命题计划统计数据
     *
     * @param examId     考试id
     * @param courseCode 课程编号
     * @return 命题计划统计数据
     */
    List<ExamTaskPlanStatisticDto> findByExamIdCourseCode(@Param("examId") Long examId, @Param("courseCode") String courseCode);
}
