package com.ym.mec.biz.dal.dao;

import com.ym.mec.biz.dal.dto.ExtraExerciseStudentsDto;
import com.ym.mec.biz.dal.dto.StudentServiceDetailDto;
import com.ym.mec.biz.dal.entity.ExtracurricularExercisesReply;
import com.ym.mec.biz.dal.dto.StudentServiceHomeworkDto;
import com.ym.mec.common.dal.BaseDAO;
import org.apache.ibatis.annotations.Param;

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

public interface ExtracurricularExercisesReplyDao extends BaseDAO<Long, ExtracurricularExercisesReply> {

    /**
     * @describe 批量插入
     * @author Joburgess
     * @date 2020/3/26
     * @param replies:
     * @return int
     */
    int batchInsert(@Param("replies")List<ExtracurricularExercisesReply> replies);

    /**
     * @describe 获取课外训练的学生列表
     * @author Joburgess
     * @date 2020/3/26
     * @param extraExerciseId: 课外训练编号
     * @param studentName: 学生名称
     * @return java.util.List<com.ym.mec.biz.dal.dto.ExtraExerciseStudentsDto>
     */
    List<ExtraExerciseStudentsDto> findExtraExerciseStudents(@Param("extraExerciseId") Long extraExerciseId,
                                                             @Param("studentName") String studentName);

    /**
     * @describe 根据课外作业获取对应的学生列表
     * @author Joburgess
     * @date 2020/3/26
     * @param extraExerciseIds:
     * @return java.util.List<com.ym.mec.biz.dal.entity.ExtracurricularExercisesReply>
     */
    List<ExtracurricularExercisesReply> findExtraExerciseStudentsByExtraExercises(@Param("extraExerciseIds") List<Long> extraExerciseIds);

    /**
     * @describe 获取学生课外训练详情
     * @author Joburgess
     * @date 2020/3/26
     * @param extraExerciseReplyId:
     * @return com.ym.mec.biz.dal.dto.ExtraExerciseStudentsDto
     */
    ExtraExerciseStudentsDto findExtraExerciseReply(@Param("extraExerciseReplyId") Long extraExerciseReplyId);

    int countStudentExtraExercises(Map<String, Object> params);
    List<ExtraExerciseStudentsDto> findStudentExtraExercises(Map<String, Object> params);

    /**
     * @describe 统计已经提交的学生数量
     * @author Joburgess
     * @date 2020/3/26
     * @param extraExerciseId:
     * @return int
     */
    int countIsSubmitStudents(@Param("extraExerciseId") Long extraExerciseId);

    List<ExtraExerciseStudentsDto> findExtraExercises(Map<String, Object> params);
    int countExtraExercises(Map<String, Object> params);

    /**
     * @describe 获取在指定星期内无网管课学员的课外训练
     * @author Joburgess
     * @date 2020/4/10
     * @param monday:
     * @param sunday:
     * @return java.util.List<com.ym.mec.biz.dal.entity.ExtracurricularExercisesReply>
     */
    List<ExtracurricularExercisesReply> findNoPracticeStudentExercisesInWeek(@Param("monday") String monday,
                                                                             @Param("sunday") String sunday);

    /**
     * @describe 获取学员再指定时间段内的课程作业和课外训练
     * @author Joburgess
     * @date 2020.04.29
     * @param monday:
     * @param sunday:
     * @return java.util.List<com.ym.mec.biz.dal.dto.StudentServiceHomeworkDto>
     */
    List<StudentServiceHomeworkDto> findStudentHomewarksInWeek(@Param("monday") String monday,
                                                               @Param("sunday") String sunday);

    /**
     * @describe 获取学生在指定时间段内的作业详情
     * @author Joburgess
     * @date 2020.04.29
     * @param params:
     * @return java.util.List<com.ym.mec.biz.dal.dto.StudentServiceDetailDto>
     */
    List<StudentServiceDetailDto> findStudentHomeworkDetailsInTimeZone(Map<String, Object> params);
    int countStudentHomeworkDetailsInTimeZone(Map<String, Object> params);

    /**
     * @describe 获取在指定时间段内指定学员的课外训练
     * @author Joburgess
     * @date 2020.05.27
     * @param startDate:
     * @param endDate:
     * @param studentIds:
     * @return java.util.List<com.ym.mec.biz.dal.entity.ExtracurricularExercisesReply>
     */
	List<ExtracurricularExercisesReply> getStudentExercisesWithTimeZone(@Param("startDate") String startDate,
                                                                        @Param("endDate") String endDate,
                                                                        @Param("studentIds") List<Integer> studentIds);

    /**
     * @describe
     * @date 2020.06.15
     * @param startDate:
     * @param endDate:
     * @param studentIds:
     * @return java.util.Set<java.lang.Integer>
     */
    Set<Integer> checkStudentHaveExercisesInDateRange(@Param("startDate") String startDate,
                                                     @Param("endDate") String endDate,
                                                     @Param("studentIds") List<Integer> studentIds);
}
