package com.lesingle.creation.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.lesingle.creation.entity.Student;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

/**
 * 学生 Mapper 接口
 */
@Mapper
public interface StudentMapper extends BaseMapper<Student> {

    /**
     * 根据用户 ID 查询学生
     *
     * @param userId 用户 ID
     * @return 学生实体
     */
    @Select("SELECT * FROM t_biz_student WHERE user_id = #{userId} AND deleted = 0")
    Student selectByUserId(@Param("userId") Long userId);

    /**
     * 根据租户 ID 和学号查询学生
     *
     * @param tenantId 租户 ID
     * @param studentNo 学号
     * @return 学生实体
     */
    @Select("SELECT * FROM t_biz_student WHERE tenant_id = #{tenantId} AND student_no = #{studentNo} AND deleted = 0")
    Student selectByStudentNo(@Param("tenantId") Long tenantId, @Param("studentNo") String studentNo);
}
