update 优化代码生成 insertByBo 方法 针对返回主键优化

This commit is contained in:
疯狂的狮子li
2021-09-09 15:24:33 +08:00
parent 61edd5588e
commit 5bb7b0dda5
3 changed files with 16 additions and 3 deletions

View File

@ -75,7 +75,11 @@ public class TestDemoServiceImpl extends ServicePlusImpl<TestDemoMapper, TestDem
public Boolean insertByBo(TestDemoBo bo) {
TestDemo add = BeanUtil.toBean(bo, TestDemo.class);
validEntityBeforeSave(add);
return save(add);
boolean flag = save(add);
if (flag) {
bo.setId(add.getId());
}
return flag;
}
@Override

View File

@ -54,7 +54,11 @@ public class TestTreeServiceImpl extends ServicePlusImpl<TestTreeMapper, TestTre
public Boolean insertByBo(TestTreeBo bo) {
TestTree add = BeanUtil.toBean(bo, TestTree.class);
validEntityBeforeSave(add);
return save(add);
boolean flag = save(add);
if (flag) {
bo.setId(add.getId());
}
return flag;
}
@Override