package com.ruoyi.school.course.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.school.course.domain.ScClaTime;
import com.ruoyi.school.course.domain.ScClaTimeVo;
import com.ruoyi.school.course.domain.req.time.ReqClaTimeCount;
import com.ruoyi.school.course.domain.req.time.ReqSearchClaTime;
import com.ruoyi.school.course.domain.resp.time.RespClaTime;
import com.ruoyi.school.course.domain.resp.time.RespClaTimeCalendar;
import com.ruoyi.school.student.domain.resp.RespCourseClaStudent;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * <p>
 * 排课信息 Mapper 接口
 * </p>
 *
 * @author zhangby
 * @since 2020-09-16
 */
public interface ScClaTimeMapper extends BaseMapper<ScClaTime> {

    /**
     * 获取排课信息
     *
     * @param searchClaTime
     * @return
     */
    List<RespClaTimeCalendar> selectListForCalendar(ReqSearchClaTime searchClaTime);

    /**
     * 获取上课记录
     *
     * @param searchClaTime
     * @return
     */
    List<RespClaTime> selectListForAttend(@Param("searchClaTime") ReqSearchClaTime searchClaTime, @Param("page") Page page);

    /**
     * 数量
     *
     * @param reqClaTimeCount
     * @return
     */
    Integer selectClaTimeCount(ReqClaTimeCount reqClaTimeCount);

    Integer selectBookCount(@Param("ruleId") Long ruleId
            ,@Param("courseTimeId")  String courseTimeId
            , @Param("tenantId") String tenantId );

    ScClaTimeVo serlectByClaTimeId(Long courseTimeId);

    List<RespCourseClaStudent> selectStudenForClaTime(String courseTimeId);

    int checkTeacherConflict(@Param("teacherId")Long teacherId,
                             @Param("date")String date,
                             @Param("startTime")String startTime,
                             @Param("endTime")String endTime,
                             @Param("excludeScheduleId")String excludeScheduleId);
    int checkClassroomConflict(@Param("classroomId")Long classroomId,
                               @Param("date")String date,
                               @Param("startTime")String startTime,
                               @Param("endTime")String endTime,
                               @Param("excludeScheduleId")String excludeScheduleId);
}
