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

import com.ym.mec.biz.dal.dto.StudentPersonalAttendanceDto;
import com.ym.mec.biz.dal.dto.StudentStatusCountUtilEntity;
import com.ym.mec.biz.dal.entity.StudentAttendance;
import com.ym.mec.common.dal.BaseDAO;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

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

public interface StudentAttendanceDao extends BaseDAO<Long, StudentAttendance> {

    /**
     * @Author: Joburgess
     * @Date: 2019/9/11
     * 批量插入学生上课签到情况
     */
    int addStudentAttendances(List<StudentAttendance> studentAttendances);

    /**
     * 统计学生各种状态人数
     * @param classId
     * @return
     */
    List<StudentStatusCountUtilEntity> countStudentStatus(@Param("classId") Long classId);

    /**
     * @Author: Joburgess
     * @Date: 2019/9/12
     * 获取学生签到所需信息
     */
    StudentAttendance getStudentAttendanceInfo(StudentAttendance studentAttendance);

    /**
     * @Author: Joburgess
     * @Date: 2019/9/16
     * 获取学生个人上课签到记录
     */
    List<StudentPersonalAttendanceDto> queryStudentPersonalAttendances(Map<String,Object> params);

    /**
     * @Author: Joburgess
     * @Date: 2019/9/16
     * 获取学生个人上课签到记录统计
     */
    int queryStudentPersonalAttendancesCount(Map<String,Object> params);


    /**
     * @Author: Joburgess
     * @Date: 2019/9/18
     * 统计正常签到的学生数量
     */
    @Select("SELECT COUNT(*) FROM student_attendance WHERE class_group_id_=#{classGroupID} AND status_=\"NORMAL\"")
    int countNormalAttendanceStudentNums(Long classGroupID);
}