展示区域包括小程序时 初始库存不可为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

@@ -157,7 +157,7 @@ public class TbProduct implements Serializable {
private Integer isOnSale = 0; private Integer isOnSale = 0;
@Column(name = "`is_show`") @Column(name = "`is_show`")
@ApiModelProperty(value = "是否展示0-不展示 1.小程序2.收银端 9.全展示") @ApiModelProperty(value = "是否展示0-下架 1上架---废弃")
private Integer isShow = 0; private Integer isShow = 0;
@Column(name = "`type_enum`") @Column(name = "`type_enum`")

View File

@@ -231,6 +231,13 @@ public class TbProductServiceImpl implements TbProductService {
if (resources.getCategoryId() == null){ if (resources.getCategoryId() == null){
throw new BadRequestException("必填内容未填写"); 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.setImages(resources.getImages().toString());
product.setCategoryId(String.valueOf(resources.getCategoryId())); product.setCategoryId(String.valueOf(resources.getCategoryId()));
product.setIsDel(0); product.setIsDel(0);