ListUtils.partition(ids, 1000).stream()
.map(mapper::queryInfoByIds)
.flatMap(List::stream)
.collect(Collectors.toList());
1.如上述代码块所述,外层代码中处理,1000次查询一下
<if test="ids!= null and ids.size > 0">
<choose>
<when test="ids.size < 1000">
and m.id IN
<foreach collection="ids" item="id" separator="," open="(" close=")">
#{id}
</foreach>
</when>
<otherwise>
and
<foreach collection="ids" item="id" separator="or" open="(" close=")">
m.id= #{id}
</foreach>
</otherwise>
</choose>
</if>
2.在动态sql中解决,超过1000则循环or (数据超多的时候不推荐)