follow+sendMessage

Change-Id: I3e9bbcc89dfc53b9651fd8722da1b445a597629a
diff --git a/src/main/java/com/example/g8backend/mapper/FollowMapper.java b/src/main/java/com/example/g8backend/mapper/FollowMapper.java
new file mode 100644
index 0000000..f1d03af
--- /dev/null
+++ b/src/main/java/com/example/g8backend/mapper/FollowMapper.java
@@ -0,0 +1,22 @@
+package com.example.g8backend.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.example.g8backend.entity.Follow;
+import org.apache.ibatis.annotations.Delete;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+import org.apache.ibatis.annotations.Select;
+
+import java.util.List;
+
+@Mapper
+public interface FollowMapper extends BaseMapper<Follow> {
+    @Delete("DELETE FROM user_follows WHERE follower_id=#{followerId} AND followed_id=#{followedId}")
+    int deleteByPair(@Param("followerId") Long followerId, @Param("followedId") Long followedId);
+
+    @Select("SELECT followed_id FROM user_follows WHERE follower_id = #{userId}")
+    List<Long> selectFollowings(Long userId);
+
+    @Select("SELECT follower_id FROM user_follows WHERE followed_id = #{userId}")
+    List<Long> selectFollowers(Long userId);
+}