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

import com.ym.mec.biz.dal.dto.ClassGroupTeacherMapDto;
import com.ym.mec.biz.dal.entity.ClassGroupTeacherMapper;
import com.ym.mec.biz.dal.enums.GroupType;
import com.ym.mec.biz.dal.enums.TeachTypeEnum;
import com.ym.mec.common.dal.BaseDAO;
import org.apache.ibatis.annotations.Param;

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

public interface ClassGroupTeacherMapperDao extends BaseDAO<Long, ClassGroupTeacherMapper> {


    /**
     * 批量插入班级老师
     *
     * @param classGroupTeacherMapperList
     * @return
     */
    int classGroupTeachersInsert(@Param("classGroupTeacherMapperList") List<ClassGroupTeacherMapper> classGroupTeacherMapperList);

    /**
     * 查询班级老师
     *
     * @param classGroupIds
     * @return
     */
    List<ClassGroupTeacherMapper> findClassGroupTeachers(@Param("classGroupIds") String classGroupIds);

    /**
     * 查询班级老师
     *
     * @param classGroupId
     * @return
     */
    ClassGroupTeacherMapper getClassGroupTeachersRole(@Param("classGroupId") Integer classGroupId, @Param("teacherRole") String teacherRole);

    /**
     * 批量删除班级的老师关联关系
     *
     * @param classGroupTeacherMapperList
     * @return
     */
    int delMusicGroupTeacherMapper(@Param("classGroupTeacherMapperList") List<ClassGroupTeacherMapper> classGroupTeacherMapperList);

    /**
     * @param classGroupId:班级编号
     * @param teacherRole:
     * @return com.ym.mec.biz.dal.entity.ClassGroupTeacherMapper
     * @Author: Joburgess
     * @Date: 2019/10/18
     * @describe 根据班级编号和教师类型获取老师信息
     */
    ClassGroupTeacherMapper findByClassGroupAndRole(@Param("classGroupId") Integer classGroupId,
                                                    @Param("teacherRole") TeachTypeEnum teacherRole);

    /**
     * @param musicGroupId:
     * @return java.util.List<com.ym.mec.biz.dal.entity.ClassGroupTeacherMapper>
     * @describe 获取乐团下的所有主教老师
     * @author Joburgess
     * @date 2019/10/18
     */
    List<ClassGroupTeacherMapper> findByMusicGroup(String musicGroupId);

    List<ClassGroupTeacherMapper> findAllByMusicGroup(@Param("musicGroupId") String musicGroupId, @Param("groupType") GroupType groupType, @Param("teacherRole") String teacherRole);

    List<ClassGroupTeacherMapper> findByClassGroup(Integer classGroupId);

    ClassGroupTeacherMapper findByClassGroupAndTeacher(@Param("classGroupId") Integer classGroupId,
                                                       @Param("userId") Integer userId);

    /**
     * 批量查询班级的老师关联关系
     *
     * @param classGroupTeacherMapperList
     * @return
     */
    List<ClassGroupTeacherMapper> getClassGroupTeacherMapper(@Param("classGroupTeacherMapperList") List<ClassGroupTeacherMapper> classGroupTeacherMapperList, @Param("groupType") GroupType groupType);

    /**
     * 批量删除班级老师关系
     *
     * @param classGroupIds
     * @return
     */
    int delClassGroupTeacherMapper(@Param("classGroupIds") List<Integer> classGroupIds);

    /**
     * 获取助教名称列表
     *
     * @param classGroupId
     * @return
     */
    String queryTeachingNames(Integer classGroupId);

    /**
     * @param classGroupIds: 班级编号列表
     * @return java.util.List<com.ym.mec.biz.dal.entity.ClassGroupTeacherMapper>
     * @describe 根据班级编号获取教师班级关联记录
     * @author Joburgess
     * @date 2020/1/3
     */
    List<ClassGroupTeacherMapDto> findByClassGroupIds(@Param("classGroupIds") List<Integer> classGroupIds);

    /**
     * 修改老师
     *
     * @param groupId
     * @param teacherId
     */
    void updateTeacher(@Param("groupId") String groupId, @Param("teacherId") Integer teacherId, @Param("groupType") String groupType);

    /**
     * @param groupId:
     * @param groupType:
     * @return int
     * @describe 根据团体删除班级
     * @author Joburgess
     * @date 2020/2/17
     */
    int deleteByGroup(@Param("groupId") String groupId,
                      @Param("groupType") GroupType groupType);

    /**
     * 获取班级主教老师
     * @param classGroupIds
     * @param teacherRole
     * @return
     */
    List<ClassGroupTeacherMapper> findByClassGroupIdsAndType(@Param("classGroupIds") List<Integer> classGroupIds, @Param("teacherRole") String teacherRole);

    /**
     * 批量修改班级关联的老师
     * @param classGroupIds
     * @param newTeacherId
     */
    void batchUpdateTeacherByClassId(@Param("classGroupIds") List<Integer> classGroupIds,
                                     @Param("oldTeacherId") Integer oldTeacherId,
                                     @Param("newTeacherId") Integer newTeacherId);

    /**
     * 获取班级和课程上关联的老师列表
     * @param classGroupId
     * @return
     */
    Set<Integer> queryTeacherIdsByClassGroupId(@Param("classGroupId") Integer classGroupId,
                                               @Param("musicGroupId") String musicGroupId,
                                               @Param("groupType") GroupType groupType);
}
