未超過1000時的寫法:
select * from tbl_temp where id in <foreach item="item" index="index" collection="ids" open="(" separator="," close=")"> #{item} </foreach>
select * from tbl_temp where id in (1,2,3)
超過1000時的寫法:
select * from tbl_temp where <foreach item="item" index="index" collection="ids" open="(" separator="or" close=")"> id in #{item} </foreach>
select * from tbl_temp where (id in 1 or id in 2 or id in 3)
參考博客:
mybatis關於oracle in 1000個數限制的解決 - Paul Joo的專欄 - CSDN博客
https://blog.csdn.net/zsdjoo/article/details/42290591?utm_source=blogxgwz4