Commit 82abe115 authored by Junling Bu's avatar Junling Bu
Browse files

feat[litemall-admin-api]: 品牌商和分类允许空

parent 6eef7abc
...@@ -80,19 +80,19 @@ public class AdminGoodsController { ...@@ -80,19 +80,19 @@ public class AdminGoodsController {
if(StringUtils.isEmpty(goodsSn)){ if(StringUtils.isEmpty(goodsSn)){
return ResponseUtil.badArgument(); return ResponseUtil.badArgument();
} }
// 品牌商可以不设置,如果设置则需要验证品牌商存在
Integer brandId = goods.getBrandId(); Integer brandId = goods.getBrandId();
if(brandId == null){ if(brandId != null && brandId != 0) {
return ResponseUtil.badArgument(); if (brandService.findById(brandId) == null) {
} return ResponseUtil.badArgumentValue();
if(brandService.findById(brandId) == null) { }
return ResponseUtil.badArgumentValue();
} }
// 分类可以不设置,如果设置则需要验证分类存在
Integer categoryId = goods.getCategoryId(); Integer categoryId = goods.getCategoryId();
if(categoryId == null){ if(categoryId != null && categoryId != 0) {
return ResponseUtil.badArgument(); if (categoryService.findById(categoryId) == null) {
} return ResponseUtil.badArgumentValue();
if(categoryService.findById(categoryId) == null){ }
return ResponseUtil.badArgumentValue();
} }
LitemallGoodsAttribute[] attributes = goodsAllinone.getAttributes(); LitemallGoodsAttribute[] attributes = goodsAllinone.getAttributes();
......
Supports Markdown
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