本文共 501 字,大约阅读时间需要 1 分钟。
Mysql中批量添加数据一般我们使用:INSERT INTO table (字段1, 字段2) VALUES(字段1的值, 字段2的值),(字段1的值, 字段2的值)...;在Mybatis中如何实现批量插入数据
和mysql插入数据的方式一样,需要在Mapper.xml中动态拼装sql:
insert into promotion_fullcut_lv (fullcut_promotion_id, lv, full, cut) values (#{fullcutPromotionId,jdbcType=BIGINT}, #{lv.lv,jdbcType=INTEGER}, #{lv.full,jdbcType=DECIMAL}, #{lv.cut,jdbcType=DECIMAL})
如需返回插入数据的主键id:
...
转载地址:http://wbvfb.baihongyu.com/