Go directly to SQL. The idea is very simple
select * from test_table
where 1 = 1
<!-- IdList -->
<if test="IdList != null and IdList.size > 0">
AND PK_ID IN
<!-- Handle the case where Oracle does not support in when the set of in exceeds 1000 entries -->
<trim suffixOverrides=" OR PK_ID IN()"> <!-- means delete the last condition -->
<foreach collection="IdList" item="Id" index="index" open="(" close=")">
<if test="index != 0">
<choose>
<when test="index % 1000 == 999">) OR PK_ID IN (</when>
<otherwise>,</otherwise>
</choose>
</if>
#{Id}
</foreach>
</trim>
</if>