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

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

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