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){
return ServerResponse.createBySuccessMessage(“添加品类成功”);
}
return ServerResponse.createByErrorMessage(“添加品类失败”);
}