package com.xjrsoft.module.student.mapper;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.yulichang.base.MPJBaseMapper;
import com.xjrsoft.module.student.dto.BaseStudentInfoDetailDto;
import com.xjrsoft.module.student.dto.BaseStudentInfoPageDto;
import com.xjrsoft.module.student.dto.UpdateBaseStudentInfoDto;
import com.xjrsoft.module.student.entity.BaseStudentSchoolRoll;
import com.xjrsoft.module.student.vo.BaseStudentInfoCategoryVo;
import com.xjrsoft.module.student.vo.BaseStudentInfoDetailVo;
import com.xjrsoft.module.student.vo.BaseStudentInfoPageVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * @title: mapper
 * @Author 管理员
 * @Date: 2023-08-08
 * @Version 1.0
 */
@Mapper
public interface BaseStudentSchoolRollMapper extends MPJBaseMapper<BaseStudentSchoolRoll> {

    Page<BaseStudentInfoPageVo> getMobilePage(Page<BaseStudentInfoPageVo> page, BaseStudentInfoPageDto dto);

    BaseStudentInfoDetailVo getInfoById(@Param("dto") BaseStudentInfoDetailDto dto);

    Boolean updateInfoByUserId(UpdateBaseStudentInfoDto dto, Long id);

    /**
     * 根据性别统计学生人数
     * @param dto
     * @return
     */
    List<BaseStudentInfoCategoryVo> getGenderCount(@Param("dto") BaseStudentInfoPageDto dto);

    /**
     * 根据就读方式统计学生人数
     * @param dto
     * @return
     */
    List<BaseStudentInfoCategoryVo> getStudyStatusCount(@Param("dto") BaseStudentInfoPageDto dto);


    @Update("UPDATE base_student_school_roll SET class_id = #{classId} where user_id = #{userId}")
    Boolean updateStudentClass(Long classId, Long userId);

}

