...
|
...
|
@@ -84,6 +84,9 @@ public class SaleCategoryServiceImpl implements ISaleCategoryService { |
|
|
// 一级层级
|
|
|
saleCategory.setLevel(PRODUCT_SORT_LEVEL_1);
|
|
|
saleCategory.setParentId(TOP_PARENT_ID);
|
|
|
if (!saleCategoryMapper.selectByPidAndOrderBy(TOP_PARENT_ID, saleCategory.getOrderBy()).isEmpty()) {
|
|
|
throw new CommonException(201, "排序已存在:" + saleCategory.getOrderBy());
|
|
|
}
|
|
|
if(StringUtils.equals(saleCategoryResponseBo.getLinkType(), "on")) {
|
|
|
saleCategory.setLinkType("series");
|
|
|
} else {
|
...
|
...
|
@@ -95,6 +98,9 @@ public class SaleCategoryServiceImpl implements ISaleCategoryService { |
|
|
if(saleCategoryParent==null){
|
|
|
throw new CommonException(201, "父类销售类目找不到!");
|
|
|
}
|
|
|
if (!saleCategoryMapper.selectByPidAndOrderBy(saleCategory.getParentId(), saleCategory.getOrderBy()).isEmpty()) {
|
|
|
throw new CommonException(201, "排序已存在:" + saleCategory.getOrderBy());
|
|
|
}
|
|
|
saleCategory.setLevel(saleCategoryParent.getLevel()+1);
|
|
|
}
|
|
|
saleCategory.setStatus(1);//新创建的默认为“关闭”
|
...
|
...
|
@@ -113,6 +119,12 @@ public class SaleCategoryServiceImpl implements ISaleCategoryService { |
|
|
if(db_saleCategory==null){
|
|
|
throw new CommonException(201, "找不到销售类目!");
|
|
|
}
|
|
|
|
|
|
List<SaleCategory> exists = saleCategoryMapper.selectByPidAndOrderBy(db_saleCategory.getParentId(), saleCategory.getOrderBy());
|
|
|
if (exists.size() > 1 || (exists.size() == 1 && !exists.get(0).getId().equals(saleCategory.getId()))) {
|
|
|
throw new CommonException(201, "排序已存在:" + saleCategory.getOrderBy());
|
|
|
}
|
|
|
|
|
|
db_saleCategory.setCategoryName(saleCategory.getCategoryName());
|
|
|
db_saleCategory.setOrderBy(saleCategory.getOrderBy());
|
|
|
db_saleCategory.setImageUrl(saleCategory.getImageUrl());
|
...
|
...
|
|