<if test="preIds != null and preIds.size() > 0">
AND PRE_ID IN
<trim suffixOverrides=" OR PRE_ID IN ()">
<foreach collection='preIds' open='(' close=')' index='index' item='item'>
<if test="index != 0">
<choose>
<when test="index % 1000 == 999">) OR PRE_ID IN (</when>
<otherwise>,</otherwise>
</choose>
</if>
#{item}
</foreach>
</trim>
</if>