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

import com.ym.mec.biz.dal.dto.StudentSubTotalCourseTimesDto;
import com.ym.mec.biz.dal.entity.CourseSchedule;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;
import java.util.Set;

import com.ym.mec.biz.dal.entity.MusicGroupPaymentStudentCourseDetail;
import com.ym.mec.common.dal.BaseDAO;

import org.apache.ibatis.annotations.Param;

public interface MusicGroupPaymentStudentCourseDetailDao extends BaseDAO<Long, MusicGroupPaymentStudentCourseDetail> {

    /**
     * @param musicGroupPaymentStudentCourseDetails:
     * @return int
     * @describe 批量更新
     * @author qnc99
     * @date 2020/12/1 0001
     */
    int batchUpdate(@Param("paymentCourseDetails") List<MusicGroupPaymentStudentCourseDetail> musicGroupPaymentStudentCourseDetails);

    /**
     * @param studentId:
     * @param courseType:
     * @param courseMinutes:
     * @return com.ym.mec.biz.dal.entity.MusicGroupPaymentStudentCourseDetail
     * @describe 获取指定学员，指定课程，指定课程时长下的可用缴费记录
     * @author Joburgess
     * @date 2020.11.04
     */
    List<MusicGroupPaymentStudentCourseDetail> getUnUseWithStudentAndCourseTypeAndCourseMinutes(@Param("batchNo") String batchNo,
                                                                                                @Param("studentId") Integer studentId,
                                                                                                @Param("courseType") CourseSchedule.CourseScheduleType courseType);

    /**
     * @param studentId:
     * @param courseType:
     * @return com.ym.mec.biz.dal.entity.MusicGroupPaymentStudentCourseDetail
     * @describe 获取指定学员，指定课程类型下的可用缴费批次号
     * @author Joburgess
     * @date 2020.11.04
     */
    String getUnUseBatchNoWithStudentAndCourseTypeAndCourseMinutes(@Param("musicGroupId") String musicGroupId,
                                                                   @Param("studentId") Integer studentId,
                                                                   @Param("courseType") CourseSchedule.CourseScheduleType courseType,
                                                                   @Param("batchNos") List<String> batchNos);

    /**
     * @param studentIds:
     * @return java.util.List<com.ym.mec.biz.dal.entity.MusicGroupPaymentStudentCourseDetail>
     * @describe
     * @author Joburgess
     * @date 2020.11.04
     */
    List<MusicGroupPaymentStudentCourseDetail> getUnUseWithStudents(@Param("musicGroupId") String musicGroupId, @Param("studentIds") List<Integer> studentIds);

    int batchInsert(List<MusicGroupPaymentStudentCourseDetail> musicGroupPaymentStudentCourseDetailList);

    /**
     * 删除用户购买乐团课程记录
     *
     * @param userId
     * @param musicGroupId
     * @return
     */
    int deleteByUserIdAndMusicGroupId(@Param("userId") Integer userId, @Param("musicGroupId") String musicGroupId);

    /**
     * 根据缴费编号删除信息
     *
     * @param musicGroupPaymentCalenderId
     * @return
     */
    int deleteByMusicGroupPaymentCalenderId(Long musicGroupPaymentCalenderId);

    /**
     * 删除信息
     *
     * @param musicGroupPaymentCalenderDetailIdList
     * @return
     */
    int deleteByMusicGroupPaymentCalenderDetailId(List<Long> musicGroupPaymentCalenderDetailIdList);

    /**
     * 查询对象
     *
     * @param musicGroupPaymentCalenderDetailIdList
     * @return
     */
    List<MusicGroupPaymentStudentCourseDetail> queryByMusicGroupPaymentStudentCourseDetailId(List<Long> musicGroupPaymentCalenderDetailIdList);

    /**
     * 获取学员关联的每种课程类型的剩余可排课时长
     *
     * @param musicGroupId
     * @return
     */
    List<StudentSubTotalCourseTimesDto> queryStudentSubTotalCourseTimes(@Param("musicGroupId") String musicGroupId);
}
