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

import com.ym.mec.biz.dal.dto.StudentExercisesSituationDto;
import com.ym.mec.biz.dal.dto.TeacherExercisesServiceDto;
import com.ym.mec.biz.dal.entity.StudentExtracurricularExercisesSituation;
import com.ym.mec.common.dal.BaseDAO;
import org.apache.ibatis.annotations.Param;

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

public interface StudentExtracurricularExercisesSituationDao extends BaseDAO<Long, StudentExtracurricularExercisesSituation> {

    /**
     * @describe 批量插入
     * @author Joburgess
     * @date 2020/4/10
     * @param situations:
     * @return int
     */
    int batchInsert(@Param("situations")List<StudentExtracurricularExercisesSituation> situations);

    int batchUpdate(@Param("situations")List<StudentExtracurricularExercisesSituation> situations);

    /**
     * @describe 根据周一日期删除统计信息
     * @author Joburgess
     * @date 2020/4/10
     * @param monday:
     * @return int
     */
    int deleteByMonday(@Param("monday") String monday,
                       @Param("studentIds") List<Integer> studentIds);

    /**
     * @describe 删除指定学员的服务指标
     * @author Joburgess
     * @date 2020.05.28
     * @param studentId: 学员编号
     * @return int
     */
    int deleteByStudent(@Param("studentId") Integer studentId,
                        @Param("monday") String monday);

    List<StudentExercisesSituationDto> findExercisesSituations(Map<String, Object> params);
    int countExercisesSituations(Map<String, Object> params);

    List<StudentExercisesSituationDto> findExercisesSituationsById(@Param("ids") List<Long> ids);

    /**
     * @describe 统计老师指定星期的服务指标
     * @author Joburgess
     * @date 2020/4/17
     * @param monday:
     * @param teacherIds:
     * @return java.util.List<com.ym.mec.biz.dal.dto.TeaherExercisesServiceDto>
     */
    List<TeacherExercisesServiceDto> findTeacherExercisesServiceSituations(@Param("monday") String monday,
                                                                           @Param("teacherIds") List<Integer> teacherIds);

    List<StudentExtracurricularExercisesSituation> findTeacherNoStartServices(@Param("teacherId") Integer teacherId);

    /**
     * @describe 统计上周数据今日跟新的条数
     * @author Joburgess
     * @date 2020/4/20
     * @param sunday:
     * @return int
     */
    int findLastWeekTodayUpdateNum(@Param("sunday") String sunday);

    /**
     * @describe 获取学生指定星期的课外训练统计记录
     * @author Joburgess
     * @date 2020/4/22
     * @param monday:
     * @param studentId:
     * @return com.ym.mec.biz.dal.dto.StudentExercisesSituationDto
     */
    StudentExtracurricularExercisesSituation findStudentExercisesSituationsWithMonDay(@Param("monday") String monday,
                                                                          @Param("studentId") Integer studentId);

    /**
     * @describe 获取还需布置课外训练的老师，及布置学生数量
     * @author Joburgess
     * @date 2020.06.03
     * @param monday:
     * @return java.util.List<java.util.Map<java.lang.Integer,java.lang.Long>>
     */
    List<Map<Integer, Long>> getNoFinishedServiceTeacher(@Param("monday") String monday);

    /**
     * @describe 统计指定星期的服务记录数量
     * @author Joburgess
     * @date 2020/12/25 0025
     * @param sunday:
     * @return int
     */
    int countWeekServiceNum(@Param("sunday") String sunday);

    /**
     * @describe 获取指定周指定学员的服务指标
     * @author Joburgess
     * @date 2020/12/25 0025
     * @param monday:
     * @param studentIds:
     * @return java.util.List<com.ym.mec.biz.dal.entity.StudentExtracurricularExercisesSituation>
     */
    List<StudentExtracurricularExercisesSituation> findWeekServiceWithStudents(@Param("monday") String monday,
                                                                               @Param("teacherId") Integer teacherId,
                                                                               @Param("studentIds") List<Integer> studentIds);

    List<StudentExtracurricularExercisesSituation> findServiceWithCourse(@Param("monday") String monday,
                                                                         @Param("courseId") Long courseId);

}
