| | |
| | | |
| | | import cn.hutool.core.bean.BeanUtil; |
| | | import cn.hutool.core.util.StrUtil; |
| | | #if($table.crud || $table.sub) |
| | | import com.ruoyi.common.utils.PageUtils; |
| | | import com.ruoyi.common.core.page.PagePlus; |
| | | import com.ruoyi.common.core.page.TableDataInfo; |
| | | #end |
| | | import org.springframework.stereotype.Service; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Collection; |
| | | |
| | | /** |
| | | * ${functionName}Service业务层处理 |
| | |
| | | |
| | | @Override |
| | | public ${ClassName}Vo queryById(${pkColumn.javaType} ${pkColumn.javaField}){ |
| | | ${ClassName} db = this.baseMapper.selectById(${pkColumn.javaField}); |
| | | return BeanUtil.toBean(db, ${ClassName}Vo.class); |
| | | return getVoById(${pkColumn.javaField}, ${ClassName}Vo.class); |
| | | } |
| | | |
| | | #if($table.crud || $table.sub) |
| | | @Override |
| | | public TableDataInfo<${ClassName}Vo> queryPageList(${ClassName}QueryBo bo) { |
| | | PagePlus<${ClassName}, ${ClassName}Vo> result = pageVo(PageUtils.buildPagePlus(), buildQueryWrapper(bo), ${ClassName}Vo.class); |
| | | return PageUtils.buildDataInfo(result); |
| | | } |
| | | #end |
| | | |
| | | @Override |
| | | public List<${ClassName}Vo> queryList(${ClassName}QueryBo bo) { |
| | | return listVo(buildQueryWrapper(bo), ${ClassName}Vo.class); |
| | | } |
| | | |
| | | private LambdaQueryWrapper<${ClassName}> buildQueryWrapper(${ClassName}QueryBo bo) { |
| | | Map<String, Object> params = bo.getParams(); |
| | | LambdaQueryWrapper<${ClassName}> lqw = Wrappers.lambdaQuery(); |
| | | #foreach($column in $columns) |
| | |
| | | #end |
| | | #end |
| | | #end |
| | | return PageUtils.buildDataInfo(page(PageUtils.buildPagePlus(), lqw)); |
| | | return lqw; |
| | | } |
| | | |
| | | @Override |
| | | public Boolean insertByAddBo(${ClassName}AddBo bo) { |
| | | ${ClassName} add = BeanUtil.toBean(bo, ${ClassName}.class); |
| | | validEntityBeforeSave(add); |
| | | return this.save(add); |
| | | return save(add); |
| | | } |
| | | |
| | | @Override |
| | | public Boolean updateByEditBo(${ClassName}EditBo bo) { |
| | | ${ClassName} update = BeanUtil.toBean(bo, ${ClassName}.class); |
| | | validEntityBeforeSave(update); |
| | | return this.updateById(update); |
| | | return updateById(update); |
| | | } |
| | | |
| | | /** |
| | |
| | | if(isValid){ |
| | | //TODO 做一些业务上的校验,判断是否需要校验 |
| | | } |
| | | return this.removeByIds(ids); |
| | | return removeByIds(ids); |
| | | } |
| | | } |