<!-- 参数为数组 --> <select id="queryStudentArrayParam" parameterType="int" resultMap="studentMap"> select id,name,age,teacher from student <where> id in <foreach collection="array" item="stu" open="(" close=")" separator=","> #{stu} </foreach> </where> </select> <!-- 参数为list --> <select id="queryStudentListParam" parameterType="int" resultMap="studentMap"> select id,name,age,teacher from student <where> id in <foreach collection="list" item="stu" open="(" close=")" separator=","> #{stu} </foreach> </where> </select> <!-- 参数类型为List<int[]> --> <select id="queryStudentListArrayParam" parameterType="int" resultMap="studentMap"> select id,name,age,teacher from student <where> id in <foreach collection="list" item="stu" open="(" close=")" separator=","> <foreach collection="stu" item="s" open="(" close=")" separator=","> #{s} </foreach> </foreach> </where> </select> <!-- 参数为Map 其中map.put("stuParamList", list); --> <select id="queryStudentMapParam" parameterType="map" resultMap="studentMap"> select id,name,age,teacher from student <where> id in <foreach collection="stuParamList" item="stu" open="(" close=")" separator=","> #{stu} </foreach> </where> </select>