|
|
|
@ -10,12 +10,28 @@ |
|
|
|
|
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> |
|
|
|
|
limit #{start},#{count} |
|
|
|
|
</select> |
|
|
|
|
|
|
|
|
|
<select id="count" resultType="com.share.help.res.Page"> |
|
|
|
|
select count,ceil(count/#{pageSize}) as totalPage from( |
|
|
|
|
(select (select count(*) from friend where source_user_id!=#{userId})+ |
|
|
|
|
(select count(*) from friend where target_user_id!=#{userId}) as count)) as c |
|
|
|
|
select count(*) as count,ceil(count(*)/#{pageSize}) as totalPage |
|
|
|
|
from user |
|
|
|
|
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> |
|
|
|
|
</mapper> |