在Service业务处理层次上面将参数进行包装
public Long selectCustomerCountMap(List customerIdList) {
Map maps = new HashMap();
maps.put("customerIds", customerIdList);
return customerMapper.selectCustomerCountMap(maps);
}
DAO层:
Long selectCustomerCountMap(Map maps);
XML文件:
<select id="selectCustomerCountMap" parameterType="java.util.Map" resultType="java.lang.Long">
select count(1) from np_customer_info where id in
<foreach item="item" collection="customerIds" separator="," open="(" close=")" index=""> #{item, jdbcType=INTEGER}
</foreach>
</select>
==============
注意: 入参类型是java.util.Map而不再是List ,此时的collection属性值为Map中的Key值。