1.list<Integer>做参数
必须是collection
2.使用数组做参数 int[]
必须是array
3.实体中的集合或数组
必须是实体中数组或集合的属性名称
4.只有list<bean>一个参数,批量插入或修改
*list 为空则sql或报错
5.逗号分隔的字符串作为参数
注意:collection="ids.split(',')" String ids = '1,2,3';
ids 为空时,sql语句会报错,所以前面要判断为空的情况
select * from user where id in
<if test="ids !=null and ids != ''">
<foreach item="item" index="index" collection="ids.split(',')" open="(" separator=","
close=")">
#{item}
</foreach>
</if>