mybatis-plus 3.5.2
使用批量新增,无法返回实体中的主键id
// 插入(批量)
boolean saveBatch(Collection<T> entityList);
Comment From: wting1123
请问如何解决这个问题
Comment From: 85668869
我也遇到了,有解决方案么?
Comment From: nieqiurong
什么数据库,主键策略是什么样的?
Comment From: qmdx
无反馈,请反馈后打开
Comment From: zhuzhenguang
我也碰到这个问题,数据库是mysql 8,主键是auto,应该使用mysql的自增主键。mapper insert后实体会有id,但是saveBatch后,list里的实体没有id。 但是如果用H2在单元测试中是好的。
Comment From: xiaobull
使用 IService 的saveBatch()方法,可以将id批量返回到实体对象中