校验修改

This commit is contained in:
Tankaikai 2025-03-24 21:54:55 +08:00
parent eb81545075
commit 30a6cf0db7
1 changed files with 2 additions and 2 deletions

View File

@ -181,7 +181,7 @@ public class ProductServiceImpl extends ServiceImpl<ProductMapper, Product> impl
Long shopId = StpKit.USER.getShopId(0L);
boolean exists = super.exists(query().eq(Product::getName, dto.getName()).eq(Product::getShopId, shopId));
if (exists) {
throw new CzgException("商品已存在");
throw new CzgException("名称已存在");
}
Product entity = BeanUtil.copyProperties(dto, Product.class);
@ -241,7 +241,7 @@ public class ProductServiceImpl extends ServiceImpl<ProductMapper, Product> impl
dto.setShopId(shopId);
boolean exists = super.exists(query().eq(Product::getName, dto.getName()).eq(Product::getShopId, shopId).ne(Product::getId, dto.getId()));
if (exists) {
throw new CzgException("商品已存在");
throw new CzgException("名称已存在");
}
Product old = super.getById(dto.getId());
Product entity = BeanUtil.copyProperties(dto, Product.class);