xml文件:
<insert id="insertExam_grade_detailApi" useGeneratedKeys="true" parameterType="java.util.List">
<selectKey resultType="long" keyProperty="id" order="AFTER">SELECT
LAST_INSERT_ID()
</selectKey>
INSERT INTO exam_grade_detail(exam_id,emp_id,exam_q_id,exam_q_answer,exam_emp_answer)
values
<foreach collection="list" item="item" index="index" separator="," >
(#{item.exam_id},#{item.emp_id},#{item.exam_q_id},#{item.exam_q_answer},#{item.exam_emp_answer})
</foreach>
</insert>
list集合,array数组。。。。。。
controller:
List<Exam_grade_detail> examGradeDetail=JsonUtil.JsonToObj(json,new TypeToken<List<Exam_grade_detail>>(){}.getType());//转换