举个例子:现在从student表中找出所有学生id在idList中的学生信息
1.在mapper层接口中传入列表
List<Student> selectByIdList(@Param("idList") List<Integer> idList);
2.在mapper层xml文件中写sql语句
<select id="selectByIdList" resultType="Student">
SELECT * FROM student WHERE id IN (
<foreach collection="idList" separator="," item="studentId">
#{studentId}
</foreach>
)
</select>