夜雨声烦 | 7e6eb38 | 2025-04-22 01:18:00 +0800 | [diff] [blame] | 1 | package com.example.g8backend.mapper; |
| 2 | |
| 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| 4 | import com.example.g8backend.entity.Follow; |
| 5 | import org.apache.ibatis.annotations.Delete; |
| 6 | import org.apache.ibatis.annotations.Mapper; |
| 7 | import org.apache.ibatis.annotations.Param; |
| 8 | import org.apache.ibatis.annotations.Select; |
| 9 | |
| 10 | import java.util.List; |
| 11 | |
| 12 | @Mapper |
| 13 | public 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 | } |