展示区域包括小程序时 初始库存不可为0

This commit is contained in:
2024-03-12 10:33:37 +08:00
parent 11af368005
commit 1d927f7fd2
2 changed files with 8 additions and 1 deletions

View File

@@ -231,6 +231,13 @@ public class TbProductServiceImpl implements TbProductService {
if (resources.getCategoryId() == null){
throw new BadRequestException("必填内容未填写");
}
if (resources.getIsShowMall()==1){
for (TbProductSku sku : resources.getSkuList()) {
if(sku.getStockNumber()<=0){
throw new BadRequestException("上架区域包括小程序时,库存数量必须大于0。");
}
}
}
product.setImages(resources.getImages().toString());
product.setCategoryId(String.valueOf(resources.getCategoryId()));
product.setIsDel(0);