首页 > 代码库 > 【mybatis】之批量添加

【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>

 

【mybatis】之批量添加