package com.lesingle.creation.mapper;

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

/**
 * 教师 Mapper 接口
 */
@Mapper
public interface TeacherMapper extends BaseMapper<Teacher> {

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

    /**
     * 根据租户 ID 和工号查询教师
     *
     * @param tenantId 租户 ID
     * @param employeeNo 工号
     * @return 教师实体
     */
    @Select("SELECT * FROM t_biz_teacher WHERE tenant_id = #{tenantId} AND employee_no = #{employeeNo} AND deleted = 0")
    Teacher selectByEmployeeNo(@Param("tenantId") Long tenantId, @Param("employeeNo") String employeeNo);
}
