mybatis-plus
mybatis-plus copied to clipboard
IdType.AUTO时是否可以自动清空传入的ID,或者增加另外一个IdType
IdType.AUTO时是否可以自动清空传入的ID,或者增加另外一个IdType
amazonTemplate.setId(null);
amazonTemplate.getAmazonTemplateImages().forEach(item -> item.setId(null));
amazonTemplate.getAmazonTemplateVariants().forEach(item -> item.setId(null));
类似查询出来(复制)的层次比较深的数据,现在要清理完ID后才能插入
https://baomidou.com/pages/568eb2/#spring-boot
@VampireAchao 还是要用数据库的主键生成,只是很多插入的对象是查询出来的,带了之前的主键,好多地方都要清空主键再插入不方便,代码写起来也不优雅
这个是以前3.4改的,以前是直接忽略的,这种改动就有点随意了,完全没考虑正常需求
https://github.com/baomidou/mybatis-plus/pull/3592/files 3.4.1版本的时候增加了这个change,暂时看来只能显示的将id置为null
up
这个有办法解决吗