如果数据库支持批量插入,就可以通过foreach来实现。
在UserMapper接口中增加如下方法:
在UserMapper.xml中添加如下SQL:
针对该方法编写如下测试:
测试结果:
相关文章: