package com.zhentao.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zhentao.entity.MatchmakerSuccessCaseUpload;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.Map;

/**
 * 红娘上传成功案例Mapper
 */
@Mapper
public interface MatchmakerSuccessCaseUploadMapper extends BaseMapper<MatchmakerSuccessCaseUpload> {
    
    /**
     * 根据用户ID查询用户基本信息（头像、年龄等）
     * @param userId 用户ID（users表的user_id）
     * @return 用户信息Map
     */
    @Select("SELECT user_id as userId, nickname as name, avatar_url as avatarUrl, " +
            "TIMESTAMPDIFF(YEAR, birth_date, CURDATE()) as age " +
            "FROM users WHERE user_id = #{userId}")
    Map<String, Object> getUserBasicInfo(Integer userId);
}
