【mybatis】之批量添加

 mybatis批量添加xml

<insert id="batchCreate">
        INSERT INTO `roomer`
        (`order`,name,idCard,mobile,timePreCheckin,timePreCheckout,hotel) values
        <foreach collection="collection" item="item" index="index"
            separator=",">
            (
            #{item.order,jdbcType=VARCHAR},#{item.name},
            #{item.idCard},#{item.mobile},#{item.timePreCheckin},
            #{item.timePreCheckout},#{item.hotel,jdbcType=INTEGER})
        </foreach>
</insert>
原文地址:https://www.cnblogs.com/gyjx2016/p/5969270.html