Commit 66317b18 authored by shiyu's avatar shiyu

删除类目校验

parent 8ac414d6
...@@ -107,6 +107,12 @@ public class CategoryServiceImpl implements CategoryService { ...@@ -107,6 +107,12 @@ public class CategoryServiceImpl implements CategoryService {
if (id == null) { if (id == null) {
return ResponseUtil.badArgument(); return ResponseUtil.badArgument();
} }
//查询该类目下有没有子类目,有的话不能进行删除
List<Category> categorys = categoryManager.queryByPid(category.getId());
if (!CollectionUtils.isEmpty(categorys)) {
return Result.failed("该分类下有子类目,不能删除");
}
//检验该分类下有没有商品,有商品的话不能删除 //检验该分类下有没有商品,有商品的话不能删除
long count = itemManager.countByCid(id); long count = itemManager.countByCid(id);
if (count > 0) { if (count > 0) {
......
...@@ -157,6 +157,10 @@ spring: ...@@ -157,6 +157,10 @@ spring:
password: Jyt4gT06qdRZnC1z password: Jyt4gT06qdRZnC1z
database: 0 database: 0
elasticsearch:
jest:
uris: 172.16.122.190:9200
server: server:
servlet: servlet:
session: session:
......
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