package com.imooc.mapper;

import com.imooc.my.mapper.MyMapper;
import com.imooc.pojo.Fans;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;
import java.util.Set;

@Repository
public interface FansMapper extends MyMapper<Fans> {
    int updateByPrimaryKeySelective(Fans record);


    @Select("<script> " +
            "SELECT vloger_id, is_fan_friend_of_mine FROM t_fans " +
            "WHERE fan_id = #{currentUserId} " +
            "AND vloger_id IN " +
            "<foreach collection='vlogerIds' item='vlogerId' open='(' separator=',' close=')'> " +
            "#{vlogerId} " +
            "</foreach> " +
            "</script>")
    List<Map<String, Object>> getFollowedVlogerIds(@Param("currentUserId")String currentUserId,@Param("vlogerIds")List<String> vlogerIds);
//    Set<String> getFollowedVlogerIds(
//            @Param("currentUserId") String currentUserId,
//            @Param("vlogerIds") List<String> vlogerIds
//    );
}