支持添加重复名称的商品分类
This commit is contained in:
parent
d06b5ceb89
commit
177cd86366
@ -330,6 +330,7 @@ public enum ResultCode {
|
||||
STORE_APPLY_DOUBLE_ERROR(50003, "已有店铺,无需重复申请!"),
|
||||
STORE_NOT_OPEN(50004, "该会员未开通店铺"),
|
||||
STORE_NOT_LOGIN_ERROR(50005, "未登录店铺"),
|
||||
STORE_CLOSE_ERROR(50006, "店铺关闭,请联系管理员"),
|
||||
|
||||
/**
|
||||
* 结算单
|
||||
|
@ -145,7 +145,7 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, Member> impleme
|
||||
if (member.getHaveStore()) {
|
||||
Store store = storeService.getById(member.getStoreId());
|
||||
if (!store.getStoreDisable().equals(StoreStatusEnum.OPEN.name())) {
|
||||
throw new ServiceException(ResultCode.USER_NOT_EXIST);
|
||||
throw new ServiceException(ResultCode.STORE_CLOSE_ERROR);
|
||||
}
|
||||
} else {
|
||||
throw new ServiceException(ResultCode.USER_NOT_EXIST);
|
||||
|
@ -61,14 +61,6 @@ public class CategoryManagerController {
|
||||
@PostMapping
|
||||
@ApiOperation(value = "添加商品分类")
|
||||
public ResultMessage<Category> saveCategory(@Valid Category category) {
|
||||
|
||||
//不能添加重复的分类名称
|
||||
Category category1 = new Category();
|
||||
category1.setName(category.getName());
|
||||
List<Category> list = categoryService.findByAllBySortOrder(category1);
|
||||
if (StringUtils.isNotEmpty(list)) {
|
||||
throw new ServiceException(ResultCode.CATEGORY_NOT_EXIST);
|
||||
}
|
||||
//非顶级分类
|
||||
if (category.getParentId() != null && !category.getParentId().equals("0")) {
|
||||
Category parent = categoryService.getById(category.getParentId());
|
||||
@ -90,15 +82,7 @@ public class CategoryManagerController {
|
||||
public ResultMessage<Category> updateCategory(@Valid CategoryVO category) {
|
||||
Category catTemp = categoryService.getById(category.getId());
|
||||
if (catTemp == null) {
|
||||
throw new ServiceException(ResultCode.CATEGORY_PARENT_NOT_EXIST);
|
||||
}
|
||||
//不能添加重复的分类名称
|
||||
Category category1 = new Category();
|
||||
category1.setName(category.getName());
|
||||
category1.setId(category.getId());
|
||||
List<Category> list = categoryService.findByAllBySortOrder(category1);
|
||||
if (StringUtils.isNotEmpty(list)) {
|
||||
throw new ServiceException(ResultCode.CATEGORY_NAME_IS_EXIST);
|
||||
throw new ServiceException(ResultCode.CATEGORY_NOT_EXIST);
|
||||
}
|
||||
|
||||
categoryService.updateCategory(category);
|
||||
|
Loading…
x
Reference in New Issue
Block a user