Skip to content

Commit

Permalink
品牌名称非空校验
Browse files Browse the repository at this point in the history
  • Loading branch information
yxf committed Sep 14, 2022
1 parent 2a645db commit 0f2f091
Showing 1 changed file with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.mall4j.cloud.product.controller.platform;

import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.StrUtil;
import com.mall4j.cloud.api.product.vo.BrandVO;
import com.mall4j.cloud.common.database.dto.PageDTO;
import com.mall4j.cloud.common.database.vo.PageVO;
Expand Down Expand Up @@ -64,6 +65,8 @@ public ServerResponseEntity<BrandVO> getByBrandId(@RequestParam Long brandId) {
public ServerResponseEntity<Void> save(@Valid @RequestBody BrandDTO brandDTO) {
if (CollUtil.isEmpty(brandDTO.getCategoryIds())) {
throw new Mall4cloudException("分类不能为空");
}if (StrUtil.isEmpty(brandDTO.getName())) {
throw new Mall4cloudException("品牌名称不能为空");
}
Brand brand = mapperFacade.map(brandDTO, Brand.class);
brandService.save(brand, brandDTO.getCategoryIds());
Expand Down

0 comments on commit 0f2f091

Please sign in to comment.