電商專案之mybatis實現批量插入
阿新 • • 發佈:2019-01-13
<insert id="batchInsert" parameterType="list" > insert into mmall_order_item (id, user_id, order_no, product_id, product_name, product_image, current_unit_price, quantity, total_price, create_time, update_time) values <foreach collection="orderItemList" index="index" item="item" separator=","> ( #{item.id},#{item.userId},#{item.orderNo},#{item.productId},#{item.productName},#{item.productImage},#{item.currentUnitPrice},#{item.quantity}, #{item.totalPrice},now(),now() ) </foreach> </insert>