update 去除链式调用注解 不符合规范导致很多奇葩问题 例如: copy为空问题

This commit is contained in:
疯狂的狮子Li
2022-01-25 21:50:54 +08:00
parent 03bda9422d
commit 3706d2e1db
51 changed files with 56 additions and 122 deletions

View File

@ -44,7 +44,11 @@ public class TestBatchController extends BaseController {
public AjaxResult<Void> add() {
List<TestDemo> list = new ArrayList<>();
for (int i = 0; i < 1000; i++) {
list.add(new TestDemo().setOrderNum(-1L).setTestKey("批量新增").setValue("测试新增"));
TestDemo testDemo = new TestDemo();
testDemo.setOrderNum(-1L);
testDemo.setTestKey("批量新增");
testDemo.setValue("测试新增");
list.add(testDemo);
}
return toAjax(testDemoMapper.insertBatch(list) ? 1 : 0);
}
@ -60,12 +64,16 @@ public class TestBatchController extends BaseController {
public AjaxResult<Void> addOrUpdate() {
List<TestDemo> list = new ArrayList<>();
for (int i = 0; i < 1000; i++) {
list.add(new TestDemo().setOrderNum(-1L).setTestKey("批量新增").setValue("测试新增"));
}
TestDemo testDemo = new TestDemo();
testDemo.setOrderNum(-1L);
testDemo.setTestKey("批量新增");
testDemo.setValue("测试新增");
list.add(testDemo); }
testDemoMapper.insertBatch(list);
for (int i = 0; i < list.size(); i++) {
TestDemo testDemo = list.get(i);
testDemo.setTestKey("批量新增或修改").setValue("批量新增或修改");
testDemo.setTestKey("批量新增或修改");
testDemo.setValue("批量新增或修改");
if (i % 2 == 0) {
testDemo.setId(null);
}