粉丝与关注用户列表功能

This commit is contained in:
x ronger 2020-10-25 01:39:40 +08:00
parent 04f2b3626c
commit 22e0818e05

View File

@ -1,8 +1,24 @@
<?xml version="1.0" encoding="UTF-8" ?> <?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.rymcu.vertical.mapper.FollowMapper"> <mapper namespace="com.rymcu.vertical.mapper.FollowMapper">
<resultMap id="DTOResultMapper" type="com.rymcu.vertical.dto.UserDTO">
<result column="id" property="idUser"/>
<result column="account" property="account"/>
<result column="nickname" property="nickname"/>
<result column="avatar_type" property="avatarType"/>
<result column="avatar_url" property="avatarUrl"/>
<result column="signature" property="signature"/>
</resultMap>
<select id="isFollow" resultType="java.lang.Boolean"> <select id="isFollow" resultType="java.lang.Boolean">
select ifnull((select true from vertical_follow where follower_id = #{followerId} select ifnull((select true from vertical_follow where follower_id = #{followerId}
and following_id = #{followingId} and following_type = #{followingType}), false) and following_id = #{followingId} and following_type = #{followingType}), false)
</select> </select>
<select id="selectUserFollowersByUser" resultMap="DTOResultMapper">
select id, nickname, avatar_type, avatar_url, account, signature from vertical_user vu
where exists (select * from vertical_follow vf where following_type = 0 and following_id = #{idUser} and follower_id = vu.id limit 1)
</select>
<select id="selectUserFollowingsByUser" resultMap="DTOResultMapper">
select id, nickname, avatar_type, avatar_url, account, signature from vertical_user vu
where id = #{idUser} and exists (select * from vertical_follow vf where following_type = 0 and follower_id = #{idUser} and following_id = vu.id limit 1)
</select>
</mapper> </mapper>