下面介绍两种mybatis中传入数组参数的方法 第一种:直接传递数组数据 mapper中的配置: [html] view plain copy print ? <delete id="deleteBrandByIdsArray" parameterType="Integer[]"> delete from bbs_brand <where> id <foreach collection="array" item="id" open="in (" close=")" separator=","> #{id} </foreach> </where> </delete> [html] view plain copy print ? service中的配置: [html] view plain copy print ? public void deleteBrandById(Integer[] ids) { brandMapper.deleteBrandByIdsArray(ids); } 第二种:将数组放在map中传递: mapper中的配置: [html] view plain copy print ? <delete id="deleteBrandByIds" parameterType="java.util.Map"> delete from bbs_brand <where> id <foreach collection="ids" item="id" open="in (" close=")" separator=","> #{id} </foreach> </where> </delete>