package com.zhentao.mapper;

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

/**
 * 红娘点赞记录Mapper接口
 */
@Mapper
public interface MatchmakerLikeMapper extends BaseMapper<MatchmakerLike> {
    
    /**
     * 查询用户本周是否已对某红娘点赞
     * 
     * @param userId 用户ID
     * @param matchmakerId 红娘ID
     * @param weekKey 周标识
     * @return 点赞记录数
     */
    @Select("SELECT COUNT(*) FROM matchmaker_likes WHERE user_id = #{userId} AND matchmaker_id = #{matchmakerId} AND week_key = #{weekKey}")
    int countByUserAndMatchmakerAndWeek(@Param("userId") Long userId, 
                                         @Param("matchmakerId") Long matchmakerId, 
                                         @Param("weekKey") String weekKey);
    
    /**
     * 统计红娘本周获得的点赞数
     * 
     * @param matchmakerId 红娘ID
     * @param weekKey 周标识
     * @return 点赞数
     */
    @Select("SELECT COUNT(*) FROM matchmaker_likes WHERE matchmaker_id = #{matchmakerId} AND week_key = #{weekKey}")
    int countWeeklyLikes(@Param("matchmakerId") Long matchmakerId, @Param("weekKey") String weekKey);
}
