<if test="resident.tagsId != null and resident.tegsId = ''">
<foreach collection="resident.tagsId.split(',')" item="item" >
and exists (select resident_id from sys_resident_tags
where resident_id = sr.resident_id AND tags_id = #{item})
</foreach>
</if>