图库需求
This commit is contained in:
@@ -88,6 +88,7 @@ public class ShopProdUnitServiceImpl extends ServiceImpl<ShopProdUnitMapper, Sho
|
||||
|
||||
@Override
|
||||
public void updateShopProdUnit(ShopProdUnitDTO dto) {
|
||||
checkShopProdUnit(dto.getId());
|
||||
Long shopId = StpKit.USER.getShopId(0L);
|
||||
dto.setShopId(shopId);
|
||||
boolean exists = super.exists(query().eq(ShopProdUnit::getName, dto.getName())
|
||||
@@ -107,26 +108,14 @@ public class ShopProdUnitServiceImpl extends ServiceImpl<ShopProdUnitMapper, Sho
|
||||
|
||||
@Override
|
||||
public void deleteShopProdUnit(Long id) {
|
||||
ShopProdUnit entity = super.getById(id);
|
||||
if (entity == null) {
|
||||
throw new CzgException("单位信息不存在");
|
||||
}
|
||||
if (entity.getIsSystem() == YesNoEnum.YES.value()) {
|
||||
throw new CzgException("系统预设单位不可操作");
|
||||
}
|
||||
checkShopProdUnit(id);
|
||||
Long shopId = StpKit.USER.getShopId(0L);
|
||||
super.remove(query().eq(ShopProdUnit::getId, id).eq(ShopProdUnit::getShopId, shopId));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void disableShopProdUnit(Long id) {
|
||||
ShopProdUnit entity = super.getById(id);
|
||||
if (entity == null) {
|
||||
throw new CzgException("单位信息不存在");
|
||||
}
|
||||
if (entity.getIsSystem() == YesNoEnum.YES.value()) {
|
||||
throw new CzgException("系统预设单位不可操作");
|
||||
}
|
||||
checkShopProdUnit(id);
|
||||
Long shopId = StpKit.USER.getShopId(0L);
|
||||
UpdateChain.of(ShopProdUnit.class)
|
||||
.set(ShopProdUnit::getStatus, StatusEnum.DISABLE.value())
|
||||
@@ -137,13 +126,7 @@ public class ShopProdUnitServiceImpl extends ServiceImpl<ShopProdUnitMapper, Sho
|
||||
|
||||
@Override
|
||||
public void enableShopProdUnit(Long id) {
|
||||
ShopProdUnit entity = super.getById(id);
|
||||
if (entity == null) {
|
||||
throw new CzgException("单位信息不存在");
|
||||
}
|
||||
if (entity.getIsSystem() == YesNoEnum.YES.value()) {
|
||||
throw new CzgException("系统预设单位不可操作");
|
||||
}
|
||||
checkShopProdUnit(id);
|
||||
Long shopId = StpKit.USER.getShopId(0L);
|
||||
UpdateChain.of(ShopProdUnit.class)
|
||||
.set(ShopProdUnit::getStatus, StatusEnum.ENABLED.value())
|
||||
@@ -151,4 +134,14 @@ public class ShopProdUnitServiceImpl extends ServiceImpl<ShopProdUnitMapper, Sho
|
||||
.eq(ShopProdUnit::getShopId, shopId)
|
||||
.update();
|
||||
}
|
||||
|
||||
private void checkShopProdUnit(Long id) {
|
||||
ShopProdUnit entity = super.getById(id);
|
||||
if (entity == null) {
|
||||
throw new CzgException("单位信息不存在");
|
||||
}
|
||||
if (entity.getIsSystem() == YesNoEnum.YES.value()) {
|
||||
throw new CzgException("系统预设单位不可操作");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user