|
|
@ -10,12 +10,28 @@ |
|
|
|
select source_user_id as userId from friend where source_user_id!=#{userId} and target_user_id=#{userId} |
|
|
|
select source_user_id as userId from friend where source_user_id!=#{userId} and target_user_id=#{userId} |
|
|
|
union all |
|
|
|
union all |
|
|
|
select target_user_id as userId from friend where target_user_id!=#{userId} and source_user_id=#{userId}) |
|
|
|
select target_user_id as userId from friend where target_user_id!=#{userId} and source_user_id=#{userId}) |
|
|
|
|
|
|
|
<if test="name!=null and name!=''"> |
|
|
|
|
|
|
|
and name like '%${name}%' |
|
|
|
|
|
|
|
</if> |
|
|
|
limit #{start},#{count} |
|
|
|
limit #{start},#{count} |
|
|
|
</select> |
|
|
|
</select> |
|
|
|
|
|
|
|
|
|
|
|
<select id="count" resultType="com.share.help.res.Page"> |
|
|
|
<select id="count" resultType="com.share.help.res.Page"> |
|
|
|
select count,ceil(count/#{pageSize}) as totalPage from( |
|
|
|
select count(*) as count,ceil(count(*)/#{pageSize}) as totalPage |
|
|
|
(select (select count(*) from friend where source_user_id!=#{userId})+ |
|
|
|
from user |
|
|
|
(select count(*) from friend where target_user_id!=#{userId}) as count)) as c |
|
|
|
where user_id in ( |
|
|
|
|
|
|
|
select source_user_id as userId |
|
|
|
|
|
|
|
from friend |
|
|
|
|
|
|
|
where source_user_id != #{userId} |
|
|
|
|
|
|
|
and target_user_id = #{userId} |
|
|
|
|
|
|
|
union all |
|
|
|
|
|
|
|
select target_user_id as userId |
|
|
|
|
|
|
|
from friend |
|
|
|
|
|
|
|
where target_user_id != #{userId} |
|
|
|
|
|
|
|
and source_user_id = #{userId} |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
<if test="name!=null and name!=''"> |
|
|
|
|
|
|
|
and name like '%${name}%' |
|
|
|
|
|
|
|
</if> |
|
|
|
</select> |
|
|
|
</select> |
|
|
|
</mapper> |
|
|
|
</mapper> |