(1) 将List转换为String
String Str = list.stream().map(t -> t.toString()).collect(Collectors.joining(","));
<if test="Str!=null and Str!=''">
and Id in (${Str})
</if>
(2) 将List分批查询
List<List<Long>> devListAll = Lists.partition(List, 10000);