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

import com.ym.mec.common.dal.BaseDAO;
import com.ym.mec.biz.dal.entity.MusicGroupSchoolTermStudentCourseDetail;
import org.apache.ibatis.annotations.Param;

import java.util.List;

public interface MusicGroupSchoolTermStudentCourseDetailDao extends BaseDAO<Long, MusicGroupSchoolTermStudentCourseDetail> {


    /**
     * 初始化会员团学员排课详情
     * @param studentCourseDetail
     * @param studentIds
     */
    void init(@Param("studentCourseDetail") MusicGroupSchoolTermStudentCourseDetail studentCourseDetail, @Param("studentIds") List<Integer> studentIds);

    /**
     * 删除预排课计划
     * @param courseDetailId
     */
    void deleteByDetailId(@Param("courseDetailId") Integer courseDetailId, @Param("studentId") Integer studentId);

    /**
     * 获取预排课计划
     * @param courseDetailId
     */
    List<MusicGroupSchoolTermStudentCourseDetail> findByDetailId(Integer courseDetailId);

    /**
     * 获取所选学员最小可排课时长
     * @param musicGroupSchoolTermCourseDetailId
     * @param studentIds
     * @return
     */
    int getMixCourseMinutes(@Param("courseDetailId") Integer musicGroupSchoolTermCourseDetailId, @Param("studentIds") List<Integer> studentIds);

    /**
     * 获取所选学员最大的已消耗的单技课时长
     * @param musicGroupSchoolTermCourseDetailId
     * @param studentIds
     * @return
     */
    int getMaxSingleCourseMinutes(@Param("courseDetailId") Integer musicGroupSchoolTermCourseDetailId, @Param("studentIds") List<Integer> studentIds);

    /**
     * 获取所选学员最大的已消耗的合奏课时长
     * @param musicGroupSchoolTermCourseDetailId
     * @param studentIds
     * @return
     */
    int getMaxMixCourseMinutes(@Param("courseDetailId") Integer musicGroupSchoolTermCourseDetailId, @Param("studentIds") List<Integer> studentIds);

    /**
     * 是否有学员课时没有消耗
     * @param musicGroupSchoolTermCourseDetailId
     * @return
     */
    String getNoCourseStudentName(Integer musicGroupSchoolTermCourseDetailId);

    /**
     * 更新学员排课时长
     * @param musicGroupSchoolTermCourseDetailId
     * @param preMemberCourseMinutes
     * @param mixCourseMinutes
     * @param singleCourseMinutes
     * @param studentIds
     */
    void updateMinutes(@Param("musicGroupSchoolTermCourseDetailId") Integer musicGroupSchoolTermCourseDetailId,
                       @Param("preMemberCourseMinutes") Integer preMemberCourseMinutes,
                       @Param("mixCourseMinutes") Integer mixCourseMinutes,
                       @Param("singleCourseMinutes") Integer singleCourseMinutes,
                       @Param("studentIds") List<Integer> studentIds);

    /**
     * 更新学员排课时长
     * @param musicGroupSchoolTermCourseDetailId
     * @param preMemberCourseMinutes
     * @param mixCourseMinutes
     * @param singleCourseMinutes
     */
    void cutMinutes(@Param("musicGroupSchoolTermCourseDetailId") Integer musicGroupSchoolTermCourseDetailId,
                       @Param("preMemberCourseMinutes") Integer preMemberCourseMinutes,
                       @Param("mixCourseMinutes") Integer mixCourseMinutes,
                       @Param("singleCourseMinutes") Integer singleCourseMinutes,
                       @Param("studentId") Integer studentId);

    /**
     * 清空预排课
     * @param musicGroupSchoolTermCourseDetailId
     */
    void cleanMinutes(Integer musicGroupSchoolTermCourseDetailId);

    /**
     * 获取学员预排课计划
     * @param courseDetailId
     * @param userId
     * @return
     */
    MusicGroupSchoolTermStudentCourseDetailDao findByDetailIdAndStudentId(@Param("courseDetailId") Integer courseDetailId, @Param("userId") Integer userId);
}