From 30483dacfb18edea1054139343aacad478567df5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=96=AF=E7=8B=82=E7=9A=84=E7=8B=AE=E5=AD=90li?= <15040126243@163.com> Date: Thu, 16 Dec 2021 11:52:55 +0800 Subject: [PATCH] =?UTF-8?q?update=20=E5=9B=9E=E6=BB=9A=E9=94=99=E8=AF=AF?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/resources/vm/java/serviceImpl.java.vm | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/ruoyi-generator/src/main/resources/vm/java/serviceImpl.java.vm b/ruoyi-generator/src/main/resources/vm/java/serviceImpl.java.vm index 06c4f6b1..ad19c77a 100644 --- a/ruoyi-generator/src/main/resources/vm/java/serviceImpl.java.vm +++ b/ruoyi-generator/src/main/resources/vm/java/serviceImpl.java.vm @@ -31,14 +31,14 @@ public class ${ClassName}ServiceImpl extends ServicePlusImpl<${ClassName}Mapper, @Override public ${ClassName}Vo queryById(${pkColumn.javaType} ${pkColumn.javaField}){ - return baseMapper.selectVoById(${pkColumn.javaField}); + return getVoById(${pkColumn.javaField}); } #if($table.crud || $table.sub) @Override public TableDataInfo<${ClassName}Vo> queryPageList(${ClassName}Bo bo, PageQuery pageQuery) { LambdaQueryWrapper<${ClassName}> lqw = buildQueryWrapper(bo); - Page<${ClassName}Vo> result = baseMapper.selectVoPage(pageQuery.build(), lqw); + Page<${ClassName}Vo> result = pageVo(pageQuery.build(), lqw); return TableDataInfo.build(result); } #end @@ -46,7 +46,7 @@ public class ${ClassName}ServiceImpl extends ServicePlusImpl<${ClassName}Mapper, @Override public List<${ClassName}Vo> queryList(${ClassName}Bo bo) { LambdaQueryWrapper<${ClassName}> lqw = buildQueryWrapper(bo); - return baseMapper.selectVoList(lqw); + return listVo(lqw); } private LambdaQueryWrapper<${ClassName}> buildQueryWrapper(${ClassName}Bo bo) { @@ -80,19 +80,19 @@ public class ${ClassName}ServiceImpl extends ServicePlusImpl<${ClassName}Mapper, public Boolean insertByBo(${ClassName}Bo bo) { ${ClassName} add = BeanUtil.toBean(bo, ${ClassName}.class); validEntityBeforeSave(add); - int rows = baseMapper.insert(add); + boolean flag = save(add); #set($pk=$pkColumn.javaField.substring(0,1).toUpperCase() + ${pkColumn.javaField.substring(1)}) - if (rows > 0) { + if (flag) { bo.set$pk(add.get$pk()); } - return rows > 0; + return flag; } @Override public Boolean updateByBo(${ClassName}Bo bo) { ${ClassName} update = BeanUtil.toBean(bo, ${ClassName}.class); validEntityBeforeSave(update); - return baseMapper.updateById(update) > 0; + return updateById(update); } /** @@ -109,6 +109,6 @@ public class ${ClassName}ServiceImpl extends ServicePlusImpl<${ClassName}Mapper, if(isValid){ //TODO 做一些业务上的校验,判断是否需要校验 } - return baseMapper.deleteBatchIds(ids) > 0; + return removeByIds(ids); } }