static.template.server.service.DemoServiceImpl.tp Maven / Gradle / Ivy
package {packPath}.{rootModule}.{moduleName}.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springframework.stereotype.Service;
import io.github.wslxm.springbootplus2.core.base.model.BasePage;
import io.github.wslxm.springbootplus2.core.constant.SymbolConst;
import io.github.wslxm.springbootplus2.core.base.service.impl.BaseServiceImpl;
import io.github.wslxm.springbootplus2.core.utils.XjBeanUtil;
import {packPath}.{rootModule}.{moduleName}.mapper.{tableNameUp}Mapper;
import {packPath}.{rootModule}.{moduleName}.service.{tableNameUp}Service;
import {packPath}.{rootModule}.{moduleName}.model.entity.{tableNameUp};
import {packPath}.{rootModule}.{moduleName}.model.vo.{tableNameUp}VO;
import {packPath}.{rootModule}.{moduleName}.model.dto.{tableNameUp}DTO;
import {packPath}.{rootModule}.{moduleName}.model.query.{tableNameUp}Query;
import org.apache.commons.lang3.StringUtils;
import java.util.List;
/**
* {tableComment} ServiceImpl
*
*
* {describe}
*
* @author {author}
* @email {email}
* @date {date}
*/
@Service
public class {tableNameUp}ServiceImpl extends BaseServiceImpl<{tableNameUp}Mapper, {tableNameUp}> implements {tableNameUp}Service {
{filterCrud}
@Override
public BasePage<{tableNameUp}VO> findPage({tableNameUp}Query query) {
LambdaQueryWrapper<{tableNameUp}> queryWrapper = new LambdaQueryWrapper<{tableNameUp}>().orderByDesc({tableNameUp}::getCreateTime);
{findPageMybatisPlus}
Page<{tableNameUp}> page = this.page(new Page<>(query.getCurrent(), query.getSize()), queryWrapper);
return XjBeanUtil.pageVo(page, {tableNameUp}VO.class);
}
@Override
public {tableNameUp}VO findId(String id) {
return XjBeanUtil.convert(this.getById(id), {tableNameUp}VO.class);
}
@Override
public String insert({tableNameUp}DTO dto) {
{tableNameUp} entity = dto.convert({tableNameUp}.class);
boolean b = this.save(entity);
return entity.getId();
}
@Override
public boolean upd(String id, {tableNameUp}DTO dto) {
{tableNameUp} entity = dto.convert({tableNameUp}.class);
entity.setId(id);
return this.updateById(entity);
}
@Override
public boolean del(String id) {
return this.removeById(id);
}
{filterCrud}
}