校验修改
This commit is contained in:
parent
eb81545075
commit
30a6cf0db7
|
|
@ -181,7 +181,7 @@ public class ProductServiceImpl extends ServiceImpl<ProductMapper, Product> impl
|
||||||
Long shopId = StpKit.USER.getShopId(0L);
|
Long shopId = StpKit.USER.getShopId(0L);
|
||||||
boolean exists = super.exists(query().eq(Product::getName, dto.getName()).eq(Product::getShopId, shopId));
|
boolean exists = super.exists(query().eq(Product::getName, dto.getName()).eq(Product::getShopId, shopId));
|
||||||
if (exists) {
|
if (exists) {
|
||||||
throw new CzgException("商品已存在");
|
throw new CzgException("名称已存在");
|
||||||
}
|
}
|
||||||
|
|
||||||
Product entity = BeanUtil.copyProperties(dto, Product.class);
|
Product entity = BeanUtil.copyProperties(dto, Product.class);
|
||||||
|
|
@ -241,7 +241,7 @@ public class ProductServiceImpl extends ServiceImpl<ProductMapper, Product> impl
|
||||||
dto.setShopId(shopId);
|
dto.setShopId(shopId);
|
||||||
boolean exists = super.exists(query().eq(Product::getName, dto.getName()).eq(Product::getShopId, shopId).ne(Product::getId, dto.getId()));
|
boolean exists = super.exists(query().eq(Product::getName, dto.getName()).eq(Product::getShopId, shopId).ne(Product::getId, dto.getId()));
|
||||||
if (exists) {
|
if (exists) {
|
||||||
throw new CzgException("商品已存在");
|
throw new CzgException("名称已存在");
|
||||||
}
|
}
|
||||||
Product old = super.getById(dto.getId());
|
Product old = super.getById(dto.getId());
|
||||||
Product entity = BeanUtil.copyProperties(dto, Product.class);
|
Product entity = BeanUtil.copyProperties(dto, Product.class);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue