select * from table a
<where>
<if test="list != null and list.size > 0">
and a.name in
<foreach collection="list" index="index" item="item" open="(" separator="," close=")">
<if test="(index % 999) == 998"> ) or a.name in (</if> #{item}
</foreach >
</if>
</where>