mybatis三种批量插入方式对比

<insert id="addInquiryQA" parameterType="java.util.List">
        insert into inquiry_resul_question (result_bill_id, question_id, answer_id, fill_in_answer) 
        VALUES
        <foreach collection="list" item="item" separator=",">
            (#{item.resultBillId,jdbcType=INTEGER}, #{item.questionId,jdbcType=INTEGER},
            #{item.answerId,jdbcType=INTEGER}, #{item.fillInAnswer,jdbcType=VARCHAR})
        </foreach>
    </insert>

传入的是对象集合

posted @ 2018-08-10 15:42  晨子语  阅读(181)  评论(0编辑  收藏  举报