select id,name from user where
<if test="ids!=null and ids!=''">
id in
<foreach collection="ids.split(',')" item="item" index="index" open="(" separator="," close=")">
#{item}
</foreach>
</if>
select id,name from user where
<if test="ids!=null and ids!=''">
id in
<foreach collection="ids.split(',')" item="item" index="index" open="(" separator="," close=")">
#{item}
</foreach>
</if>