Commit 80aaca4e authored by shiyu's avatar shiyu

新增子类目

parent d1143050
...@@ -94,14 +94,13 @@ public class CategoryServiceImpl implements CategoryService { ...@@ -94,14 +94,13 @@ public class CategoryServiceImpl implements CategoryService {
public void create(CategoryVo categoryVo) { public void create(CategoryVo categoryVo) {
Integer pid = categoryVo.getPid(); Integer pid = categoryVo.getPid();
Category category = categoryVo.toDo(); Category category = categoryVo.toDo();
if (null != pid) { //父类目设置成非叶子结点
Category pCat = new Category(); Category pCat = new Category();
pCat.setId(pid); pCat.setId(pid);
pCat.setIsLeaf(false); pCat.setIsLeaf(false);
categoryManager.updateById(pCat); categoryManager.updateById(pCat);
} else { //新建的类目为叶子节点
category.setIsLeaf(true); category.setIsLeaf(true);
}
categoryManager.add(category); categoryManager.add(category);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment