|
|
|
|
@ -7,10 +7,10 @@ |
|
|
|
|
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of |
|
|
|
|
* the Software, and to permit persons to whom the Software is furnished to do so, |
|
|
|
|
* subject to the following conditions: |
|
|
|
|
|
|
|
|
|
* <p> |
|
|
|
|
* The above copyright notice and this permission notice shall be included in all |
|
|
|
|
* copies or substantial portions of the Software. |
|
|
|
|
|
|
|
|
|
* <p> |
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
|
|
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS |
|
|
|
|
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR |
|
|
|
|
@ -71,6 +71,7 @@ public class CategoryBizImpl extends BaseBizImpl<ICategoryDao, CategoryEntity> i |
|
|
|
|
// TODO Auto-generated method stub
|
|
|
|
|
return categoryDao.queryChildren(category); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public void saveEntity(CategoryEntity categoryEntity) { |
|
|
|
|
// TODO Auto-generated method stub
|
|
|
|
|
@ -133,6 +134,7 @@ public class CategoryBizImpl extends BaseBizImpl<ICategoryDao, CategoryEntity> i |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void setChildParentId(CategoryEntity categoryEntity, String topId) { |
|
|
|
|
CategoryEntity category = new CategoryEntity(); |
|
|
|
|
category.setCategoryId(categoryEntity.getId()); |
|
|
|
|
@ -211,22 +213,22 @@ public class CategoryBizImpl extends BaseBizImpl<ICategoryDao, CategoryEntity> i |
|
|
|
|
|
|
|
|
|
//获取被删节点的父节点
|
|
|
|
|
CategoryEntity parentNode = categoryDao.selectById(category.getCategoryId()); |
|
|
|
|
//清空CategoryParentIds,避免查找不必要的数据,只需要当前的父级栏目
|
|
|
|
|
parentNode.setCategoryParentIds(null); |
|
|
|
|
//获取被删节点的所属栏目的其他节点
|
|
|
|
|
List<CategoryEntity> childNode = categoryDao.queryChildren(parentNode); |
|
|
|
|
//判断删除的是否为主节点
|
|
|
|
|
if (parentNode != null) { |
|
|
|
|
UpdateWrapper<CategoryEntity> updateWrapper = new UpdateWrapper<>(); |
|
|
|
|
|
|
|
|
|
//是否还有子节点
|
|
|
|
|
if (childNode.size() > 1) |
|
|
|
|
updateWrapper.eq("id", parentNode.getId()).set("leaf", 0); |
|
|
|
|
else |
|
|
|
|
//如果没有子节点进行更新代码
|
|
|
|
|
if (childNode.size() == 1) { |
|
|
|
|
updateWrapper.eq("id", parentNode.getId()).set("leaf", 1); |
|
|
|
|
|
|
|
|
|
categoryDao.update(null, updateWrapper); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|