Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[功能改进]: saveBatch方法重载,使其达到真正的批量添加(mysql) #6487

Open
3 tasks done
fengyujun opened this issue Sep 13, 2024 · 0 comments
Open
3 tasks done

Comments

@fengyujun
Copy link

确认

  • 我的版本是最新版本, 我的版本号与 version 相同, 并且项目里无依赖冲突
  • 我已经在 issue 中搜索过, 确认问题没有被提出过
  • 我已经修改标题, 将标题中的 描述 替换为遇到的问题

功能改进

希望达到 insert into t_user values(), (), (); 这种效果; 使用官方提供的方法注入插件 insertIntoSomeColumn 会出现源码中注释提到的数据库默认值的问题,所以基于此我这边 利用注入插件以及拦截器两个地方来实现真正的批量插入。原理就是通过具体的values反推出所需要的列。自定义的MysqlInsertBatch 里面只做 insertBatch 方法的MappedStatement对象添加 ,真正的批量sql生成由后边自定义的MysqlInsertBatchInterceptor来完成,部分源码片断
源码片断

此种批量添加要求:必须保证每个value里面的参数个数与类型完全一样

不知是否可采纳

参考资料

No response

@fengyujun fengyujun changed the title [功能改进]: saveBatch方法没有达到真正的批量添加效果,导致效率低下 [功能改进]: saveBatch方法重载,使其达到真正的批量添加 Sep 13, 2024
@fengyujun fengyujun changed the title [功能改进]: saveBatch方法重载,使其达到真正的批量添加 [功能改进]: saveBatch方法重载,使其达到真正的批量添加(mysql) Sep 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant