<select id="getList" resultType="demo.Bean">
select * from user
where user_name REGEXP concat('(^|,)(',
concat_ws('|',
<foreach collection="ids" item="item" open="" close="" separator=",">
#{item}
</foreach> ),')(,|$)')
</select>