|
@ -67,6 +67,12 @@ public class ItemServiceImpl implements ItemService { |
|
|
@Override |
|
|
@Override |
|
|
public Long createItem(ItemCreateReqVO createReqVO) { |
|
|
public Long createItem(ItemCreateReqVO createReqVO) { |
|
|
// 插入
|
|
|
// 插入
|
|
|
|
|
|
if(createReqVO.getMinInventory()==null){ |
|
|
|
|
|
createReqVO.setMinInventory(BigDecimal.ZERO); |
|
|
|
|
|
} |
|
|
|
|
|
if(createReqVO.getMaxInventory()==null){ |
|
|
|
|
|
createReqVO.setMaxInventory(BigDecimal.ZERO); |
|
|
|
|
|
} |
|
|
ItemDO item = ItemConvert.INSTANCE.convert(createReqVO); |
|
|
ItemDO item = ItemConvert.INSTANCE.convert(createReqVO); |
|
|
//String number = serialNumberApi.generateCode(RuleCodeEnum.Item.getCode());
|
|
|
//String number = serialNumberApi.generateCode(RuleCodeEnum.Item.getCode());
|
|
|
//item.setNumber(number);
|
|
|
//item.setNumber(number);
|
|
@ -88,6 +94,7 @@ public class ItemServiceImpl implements ItemService { |
|
|
public Integer updateItem(ItemUpdateReqVO updateReqVO) { |
|
|
public Integer updateItem(ItemUpdateReqVO updateReqVO) { |
|
|
// 校验存在
|
|
|
// 校验存在
|
|
|
validateItemExists(updateReqVO.getId()); |
|
|
validateItemExists(updateReqVO.getId()); |
|
|
|
|
|
|
|
|
QueryWrapper<ItemDO> objectQueryWrapper = new QueryWrapper<>(); |
|
|
QueryWrapper<ItemDO> objectQueryWrapper = new QueryWrapper<>(); |
|
|
objectQueryWrapper.eq("number", updateReqVO.getNumber().trim()); |
|
|
objectQueryWrapper.eq("number", updateReqVO.getNumber().trim()); |
|
|
objectQueryWrapper.eq("deleted", 0); |
|
|
objectQueryWrapper.eq("deleted", 0); |
|
@ -96,6 +103,12 @@ public class ItemServiceImpl implements ItemService { |
|
|
if (itemDOS.size() > 0) { |
|
|
if (itemDOS.size() > 0) { |
|
|
throw exception(ITEM_REPLACE); |
|
|
throw exception(ITEM_REPLACE); |
|
|
} |
|
|
} |
|
|
|
|
|
if(updateReqVO.getMinInventory()==null){ |
|
|
|
|
|
updateReqVO.setMinInventory(BigDecimal.ZERO); |
|
|
|
|
|
} |
|
|
|
|
|
if(updateReqVO.getMaxInventory()==null){ |
|
|
|
|
|
updateReqVO.setMaxInventory(BigDecimal.ZERO); |
|
|
|
|
|
} |
|
|
// 更新
|
|
|
// 更新
|
|
|
ItemDO updateObj = ItemConvert.INSTANCE.convert(updateReqVO); |
|
|
ItemDO updateObj = ItemConvert.INSTANCE.convert(updateReqVO); |
|
|
return itemMapper.updateById(updateObj); |
|
|
return itemMapper.updateById(updateObj); |
|
|