mirror of
https://gitee.com/ChinaLym/shoulder-platform.git
synced 2025-12-30 11:02:26 +00:00
主分支由改为main
This commit is contained in:
@@ -0,0 +1,66 @@
|
||||
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}Dao;
|
||||
import ${package}.${pkgName}.service.${className}Service;
|
||||
|
||||
|
||||
@Service
|
||||
public class ${className}ServiceImpl implements ${className}Service {
|
||||
|
||||
@Autowired
|
||||
private ${className}Dao ${lowClassName}Dao;
|
||||
|
||||
/**
|
||||
* 添加
|
||||
* @param ${lowClassName}
|
||||
*/
|
||||
public int save(${className} ${lowClassName}){
|
||||
return ${lowClassName}Dao.save(${lowClassName});
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改
|
||||
* @param ${lowClassName}
|
||||
*/
|
||||
public int update(${className} ${lowClassName}){
|
||||
return ${lowClassName}Dao.update(${lowClassName});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 删除
|
||||
* @param id
|
||||
*/
|
||||
public int delete(Long id){
|
||||
return ${lowClassName}Dao.delete(id);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 列表
|
||||
* @param params
|
||||
* @return
|
||||
*/
|
||||
public PageResult<${className}> findAll(Map<String, Object> params){
|
||||
//设置分页信息,分别是当前页数和每页显示的总记录数【记住:必须在mapper接口中的方法执行之前设置该分页信息】
|
||||
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}Dao.findAll(params);
|
||||
PageInfo<${className}> pageInfo = new PageInfo(list);
|
||||
|
||||
return PageResult.<${className}>builder().data(pageInfo.getList()).code(0).count(pageInfo.getTotal()).build();
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user