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

import com.ym.mec.biz.dal.dto.EducationDemoGroupListDto;
import com.ym.mec.biz.dal.dto.StudentDemoGroupListDto;
import com.ym.mec.biz.dal.dto.TeacherManageDemoGroupListDto;
import com.ym.mec.biz.dal.entity.CourseSchedule;
import com.ym.mec.biz.dal.entity.DemoGroup;
import com.ym.mec.common.dal.BaseDAO;
import org.apache.ibatis.annotations.Param;

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

public interface DemoGroupDao extends BaseDAO<Long, DemoGroup> {

    /**
     * @Author: Joburgess
     * @Date: 2019/9/25
     * 根据试听课ID获取班级中学生的分部ID列表
     */
    List<Integer> organIdListByDemoGroupId(Long demoGroupId);

    DemoGroup findById(Long id);

    /**
     * @Author: Joburgess
     * @Date: 2019/9/25
     * 根据用户ID获取所在部门ID
     */
    Integer getOrganIdByUserId(Long userId);

    /**
     * @Author: Joburgess
     * @Date: 2019/9/25
     * 根据试听课信息构造课程计划
     */
    List<CourseSchedule> createCourseSchedulesByDemoGroup(@Param("demoGroup") DemoGroup demoGroup,
                                                         @Param("startTime") Date startTime,
                                                         @Param("classGroupId") Long classGroupId);

    /**
     * @Author: Joburgess
     * @Date: 2019/9/25
     * 根据试听课信息构造课程计划
     */
    CourseSchedule createCourseScheduleByDemoGroupPlan(@Param("demoGroup") DemoGroup demoGroup,
                                                         @Param("coursePlanId") Long coursePlanId,
                                                         @Param("classGroupId") Long classGroupId);

    /**
     * @Author: Joburgess
     * @Date: 2019/9/25
     * 统计乐团已报名人数
     */
    Integer countDemoGroupStudents(Long demoGroupId);



    /**
     * @Author: Joburgess
     * @Date: 2019/9/25
     * 试听课列表获取
     */
    List<StudentDemoGroupListDto> findDemoGroupList(@Param("params") Map<String,Object> params,
                                                    @Param("demoGroupIds") List<Integer> demoGroupIds);

    /**
     * @Author: Joburgess
     * @Date: 2019/9/25
     * 统计试听课
     */
    Integer countDemoGroupList(Map<String,Object> params);

    List<Integer> findDemoGoupIds(Map<String,Object> params);

    /**
     * @Author: Joburgess
     * @Date: 2019/9/25
     * 根据试听课ID获取关联班级ID
     */
    Integer findClassGroupIDByDemoGroupId(Long demoGroupId);

    /**
     * @Author: Joburgess
     * @Date: 2019/9/26
     * 根据老师编号获取试听课
     */
    DemoGroup findDemoGroupByTeacherId(Integer teacherId);

    /**
     * @Author: Joburgess
     * @Date: 2019/9/26
     * 获取老师试听课安排
     */
    List<TeacherManageDemoGroupListDto> findTeacherDemoGroups(Map<String,Object> params);

    /**
     * @Author: Joburgess
     * @Date: 2019/9/26
     * 统计老师试听课安排
     */
    int countTeacherDemoGroups(Map<String,Object> params);

    /**
     * @Author: Joburgess
     * @Date: 2019/9/27
     * 根据老师获取本周内的试听课安排
     */
    List<EducationDemoGroupListDto> findDemoGroupStartClassTimesWithWeekByTeacherId(Long teacherId);

    /**
     * 根据教师编号列表获取试听课数量map
     * @param teacherIds
     * @return
     */
    List<Map<Integer, Integer>> countTeacherDemoGroupNum(String teacherIds);

    /**
     * 查询vip课程数
     * @param organIds
     * @return
     */
    Map<String, Integer> queryDemoGroupNum(@Param("organIds") String organIds);
    
    /**
     * 
     * @param organIds
     * @return
     */
    Integer queryCurrentMonthCoursesNum(@Param("organIds") String organIds);
}
