https://blog.csdn.net/sinat_28978689/article/details/79406832
解释:
当我们传递一个 List 实例或者数组作为参数对象传给 MyBatis。当你这么做的时 候,MyBatis 会自动将它包装在一个 Map 中,用名称在作为键。List 实例将会以“list” 作为键,而数组实例将会以“array”作为键。所以,当我们传递的是一个List集合时,mybatis会自动把我们的list集合包装成以list为Key值的map。
DAO层:
Long selectCustomerCountList(@Param("customerIdList") List customerIdList);
XML文件:
<select id="selectCustomerCountList" parameterType="java.util.List" resultType="java.lang.Long">
select count(1) from np_customer_info where id in
<foreach item="item" collection="customerIdList" separator="," open="(" close=")" index=""> #{item, jdbcType=INTEGER}
</foreach>
</select>
======================
注意: 此时的DAO层参数名可以 @Param("customerIdList") 与 collection的属性值一致