mirror of
https://gitee.com/ChinaLym/shoulder-platform.git
synced 2025-12-30 02:52:27 +00:00
67 lines
1.9 KiB
Plaintext
67 lines
1.9 KiB
Plaintext
package ${package}.${pkgName}.service.impl;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Service;
|
|
import org.shoulder.core.dto.response.PageResult;
|
|
import com.github.pagehelper.PageHelper;
|
|
import com.github.pagehelper.PageInfo;
|
|
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
import org.apache.commons.collections4.MapUtils;
|
|
|
|
import ${package}.${pkgName}.entity.${className};
|
|
import ${package}.${pkgName}.dao.${className}Mapper;
|
|
import ${package}.${pkgName}.service.${className}Service;
|
|
|
|
|
|
@Service
|
|
public class ${className}ServiceImpl implements ${className}Service {
|
|
|
|
@Autowired
|
|
private ${className}Mapper ${lowClassName}Mapper;
|
|
|
|
/**
|
|
* 添加
|
|
* @param ${lowClassName}
|
|
*/
|
|
public int save(${className} ${lowClassName}){
|
|
return ${lowClassName}Mapper.insert(${lowClassName});
|
|
}
|
|
|
|
/**
|
|
* 修改
|
|
* @param ${lowClassName}
|
|
*/
|
|
public int update(${className} ${lowClassName}){
|
|
return ${lowClassName}Mapper.update(${lowClassName});
|
|
}
|
|
|
|
|
|
/**
|
|
* 删除
|
|
* @param id 主键
|
|
*/
|
|
public int delete(Long id){
|
|
return ${lowClassName}Mapper.delete(id);
|
|
}
|
|
|
|
|
|
/**
|
|
* 列表
|
|
* @param params
|
|
* @return
|
|
*/
|
|
public PageResult<${className}> findAll(Map<String, Object> params){
|
|
//设置分页信息,分别是当前页数和每页显示的总记录数
|
|
if (MapUtils.getInteger(params, "page")!=null && MapUtils.getInteger(params, "limit")!=null) {
|
|
PageHelper.startPage(MapUtils.getInteger(params, "page"), MapUtils.getInteger(params, "limit"), true);
|
|
}
|
|
List<${className}> list = ${lowClassName}Mapper.findAll(params);
|
|
PageInfo<${className}> pageInfo = new PageInfo(list);
|
|
|
|
return PageResult.<${className}>builder().data(pageInfo.getList()).code(0).count(pageInfo.getTotal()).build();
|
|
}
|
|
|
|
}
|