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

import com.ym.mec.auth.api.entity.SysUser;
import com.ym.mec.biz.dal.dto.SimpleUserDto;
import com.ym.mec.biz.dal.dto.Student4operating;
import com.ym.mec.biz.dal.dto.StudentServeCourseDto;
import com.ym.mec.biz.dal.dto.StudentServeDto;
import com.ym.mec.biz.dal.entity.Student;
import com.ym.mec.biz.dal.enums.GroupType;
import org.apache.ibatis.annotations.Param;

import java.util.Date;
import java.util.List;
import java.util.Map;

public interface StudentDao extends com.ym.mec.common.dal.BaseDAO<Integer, Student> {
	
	Student getLocked(Integer userId);

    int lockUser(@Param("userId") Integer userId);

    List<Student> findByStudentIds(@Param("studentIds") List<Integer> studentIds);

    SysUser lockUserReturnInfo(@Param("userId") Integer userId);

    List<SysUser> findStudents(Map<String, Object> params);

    int countStudents(Map<String, Object> params);

    List<Student> queryByOperatingTempTag(Integer operatingTag);

    int batchUpdate(@Param("studentList") List<Student> studentList);

    /**
     * 查询运营学生列表
     *
     * @param params
     * @return
     */
    List<Student4operating> getOperatingStudents(Map<String, Object> params);

    /**
     * 查询运营学生总数
     *
     * @param params
     * @return
     */
    Integer countOperatingStudents(Map<String, Object> params);

    /**
     * 批量获取老师体验学生数
     *
     * @param teacherIds
     * @return
     */
    List<Map<Integer, Integer>> getTeacherOperatingStudentsNum(@Param("teacherIds") String teacherIds);

    List<String> getStudentNames(@Param("studentIds") List<Integer> studentIds);

    List<SimpleUserDto> getStudentsWithOrgan(Map<String, Object> params);

    int countStudentsWithOrgan(Map<String, Object> params);

    /**
     * 根据类型批量获取老师转化
     *
     * @param teacherIds
     * @param groupType
     * @return
     */
    List<Map<Integer, Integer>> getBuyNums(@Param("teacherIds") String teacherIds, @Param("groupType") GroupType groupType);

    /**
     * 根据同事存在vip和网管的转化
     *
     * @param teacherIds
     * @return
     */
    List<Map<Integer, Integer>> getPracticeAndVipNums(@Param("teacherIds") String teacherIds);

    /**
     * @return java.util.List<com.ym.mec.biz.dal.entity.Student>
     * @describe 获取服务学员列表
     * @author Joburgess
     * @date 2020.04.29
     */

    List<Student> getServiceStudents();

    /**
     * @return java.util.List<java.lang.Integer>
     * @describe 获取被服务学员id列表
     * @author Joburgess
     * @date 2020.06.04
     */
    List<Integer> getServeStudentIds();

    List<StudentServeCourseDto> getServeStudentCourseStartTimes(@Param("monday") String monday);

    List<StudentServeCourseDto> getStudentFutureCourseInfo(@Param("monday") String monday,
                                                           @Param("nextMonday") String nextMonday,
                                                           @Param("studentIds") List<Integer> studentIds);

    /**
     * @param monday:
     * @return java.util.List<com.ym.mec.biz.dal.dto.StudentServeDto>
     * @describe 查询被服务学员信息
     * @author Joburgess
     * @date 2020.05.27
     */
    List<StudentServeDto> getBeServiceStudents(@Param("monday") String monday,
                                               @Param("courseExpireDate") Date courseExpireDate);


    List<StudentServeDto> getBeServiceStudentsInfoWithStudents(@Param("monday") String monday,
                                                               @Param("courseExpireDate") Date courseExpireDate,
                                                               @Param("studentIds") List<Integer> studentIds);

    List<StudentServeDto> getBeServiceStudentsInfoWithStudentsForHistory(@Param("monday") String monday,
                                                                         @Param("courseExpireDate") Date courseExpireDate,
                                                                         @Param("studentIds") List<Integer> studentIds);

    /**
     * @param studentId:    学生编号
     * @param serviceTag:   服务指标
     * @param operatingTag: 运营指标
     * @return int
     * @describe 更新指定学员的服务指标或运营指标
     * @author Joburgess
     * @date 2020.05.28
     */
    int updateStudentServiceOrOperatingTag(@Param("studentId") Integer studentId,
                                           @Param("studentIds") List<Integer> studentIds,
                                           @Param("serviceTag") Integer serviceTag,
                                           @Param("operatingTag") Integer operatingTag);

    /**
     * @param studentId:  学生编号
     * @param serviceTag: 服务指标
     * @return int
     * @describe 更新指定学员的服务指标
     * @author Joburgess
     * @date 2020.05.28
     */
    int updateStudentServiceTag(@Param("studentId") Integer studentId,
                                @Param("studentIds") List<Integer> studentIds,
                                @Param("serviceTag") Integer serviceTag);

    /**
     * 修改学员的指导老师
     *
     * @param teacherId
     */
    void batchUpdateAdviser(@Param("teacherId") Integer teacherId, @Param("studentIds") String studentIds);

    /**
     * 获取学生的老师
     * @param studentIds
     * @return
     */
    List<Student> getStudentTeacher(@Param("studentIds") List<Integer> studentIds);
}
