spring-boot-realworld-examp.../src/main/resources/mapper/UserRelationshipQueryServic...
2017-08-18 17:08:27 +08:00

18 lines
873 B
XML

<?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" >
<mapper namespace="io.spring.infrastructure.mybatis.readservice.UserRelationshipQueryService">
<select id="isUserFollowing" resultType="java.lang.Boolean">
select count(1) from follows where user_id = #{userId} and follow_id = #{anotherUserId}
</select>
<select id="followingAuthors" resultType="java.lang.String">
select F.follow_id from follows F
where F.follow_id in
<foreach collection="ids" item="id" open="(" close=")" separator=",">
#{id}
</foreach>
and F.user_id = #{userId}
</select>
<select id="followedUsers" resultType="java.lang.String">
select F.follow_id from follows F where F.user_id = #{userId}
</select>
</mapper>