blob: f1d03af5cc341f623e6386dcd25f5b57d3b725b8 [file] [log] [blame]
夜雨声烦7e6eb382025-04-22 01:18:00 +08001package com.example.g8backend.mapper;
2
3import com.baomidou.mybatisplus.core.mapper.BaseMapper;
4import com.example.g8backend.entity.Follow;
5import org.apache.ibatis.annotations.Delete;
6import org.apache.ibatis.annotations.Mapper;
7import org.apache.ibatis.annotations.Param;
8import org.apache.ibatis.annotations.Select;
9
10import java.util.List;
11
12@Mapper
13public interface FollowMapper extends BaseMapper<Follow> {
14 @Delete("DELETE FROM user_follows WHERE follower_id=#{followerId} AND followed_id=#{followedId}")
15 int deleteByPair(@Param("followerId") Long followerId, @Param("followedId") Long followedId);
16
17 @Select("SELECT followed_id FROM user_follows WHERE follower_id = #{userId}")
18 List<Long> selectFollowings(Long userId);
19
20 @Select("SELECT follower_id FROM user_follows WHERE followed_id = #{userId}")
21 List<Long> selectFollowers(Long userId);
22}