在之前的博文中,我们已经完成了用户模块的所有的功能,那么在接下来的几篇博文中,我们来完成分类管理功能模块。
先来看一下后台的分类管理都有哪些功能点
后台品类管理其实就是对商品的一个管理,主要分为增加品类、更新品类名称、获取同级品类结点和获取品类id及子节点品类
一、分类管理模块-增加品类功能的实现
先来看Service层
// 添加品类
public ServerResponse addCategory(String categoryName, Integer parentId){
if(parentId == null || StringUtils.isBlank(categoryName)){
return ServerResponse.createByErrorMessage("参数错误");
}
Category category = new Category();
category.setName(categoryName);
category.setParentId(parentId);
category.setStatus(true);
int rowCount = categoryMapper.insert(category);
if(rowCount > 0){
ret