package com.schoolinout.system.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.schoolinout.system.domain.TeacherClassRelation;
import com.schoolinout.system.domain.dto.InsertTeacherClassRelationDto;
import com.schoolinout.system.domain.vo.TeacherClassInfoVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * 老师-班级关系Mapper接口
 *
 * @author sakura
 * @date 2024-01-04
 */
@Mapper
public interface TeacherClassRelationMapper extends BaseMapper<TeacherClassRelation> {
    /**
     * 查询老师-班级关系
     *
     * @param id 老师-班级关系主键
     * @return 老师-班级关系
     */
    public TeacherClassRelation selectTeacherClassRelationById(Long id);

    /**
     * 查询老师-班级关系列表
     *
     * @param teacherClassRelation 老师-班级关系
     * @return 老师-班级关系集合
     */
    public List<TeacherClassRelation> selectTeacherClassRelationList(TeacherClassRelation teacherClassRelation);

    /**
     * 新增老师-班级关系
     *
     * @param teacherClassRelation 老师-班级关系
     * @return 结果
     */
    public int insertTeacherClassRelation(TeacherClassRelation teacherClassRelation);

    /**
     * 修改老师-班级关系
     *
     * @param teacherClassRelation 老师-班级关系
     * @return 结果
     */
    public int updateTeacherClassRelation(TeacherClassRelation teacherClassRelation);

    /**
     * 删除老师-班级关系
     *
     * @param id 老师-班级关系主键
     * @return 结果
     */
    public int deleteTeacherClassRelationById(Long id);

    /**
     * 批量删除老师-班级关系
     *
     * @param ids 需要删除的数据主键集合
     * @return 结果
     */
    public int deleteTeacherClassRelationByIds(Long[] ids);


    int deleteRelationBySchoolIdAndTeacherId(@Param("schoolId") Long schoolId, @Param("teacherId") Long teacherId);

    int insertTeacherClassRelationBatch(@Param("list") List<InsertTeacherClassRelationDto> list);

    List<TeacherClassInfoVo> selectTeacherClass(@Param("schoolId") Long schoolId, @Param("teacherId") Long teacherId, @Param("classId") Long classId);

    void updateTeacherMainBindRelation(@Param("schoolId") Long schoolId, @Param("classId") Long classId, @Param("teacherId") Long teacherId, @Param("teacherMain") String teacherMain, @Param("setTeacherMain") String setTeacherMain);

    TeacherClassRelation selectTeacherMain(@Param("schoolId") Long schoolId, @Param("teacherId") Long teacherId, @Param("classId") Long classId);

    void deleteRelationBatch(@Param("schoolId") Long schoolId, @Param("classId") Long classId, @Param("list") List<Long> teacherRelationToRemove);

    void insertRelationBatch(@Param("schoolId") Long schoolId, @Param("classId") Long classId, @Param("list") List<Long> teacherIds);

    void deleteAllRelationsForClass(@Param("schoolId") Long schoolId, @Param("classId") Long classId, @Param("teacherId") Long teacherId);

    void deleteRelationBatchForClassId(@Param("schoolId") Long schoolId, @Param("teacherId") Long teacherId, @Param("list") List<Long> classIdsToRemove);

    void insertRelationBatchForClassId(@Param("schoolId") Long schoolId, @Param("teacherId") Long teacherId, @Param("list") List<Long> newClassIds);

    List<Long> selectTeacherBindClass(Long teacherId);
}
