Commit cf5a9d74 authored by shiyu's avatar shiyu

寄售状态不能删除

parent e5c98209
...@@ -826,6 +826,11 @@ public class ItemServiceImpl implements ItemService { ...@@ -826,6 +826,11 @@ public class ItemServiceImpl implements ItemService {
@Override @Override
public Result del(ItemRequestDto dto) { public Result del(ItemRequestDto dto) {
try { try {
List<ConsignSale> consignSales = consignSaleDao.findByItemId(dto.getId());
long count = consignSales.stream().filter(consignSale -> consignSale.getCustomState().intValue() == ConsignSaleEnum.SaleForUserStateEnum.CONSIGN_SALEING.getCode()).count();
if (count > 0) {
return Result.failed("该藏品正在寄售中,不能删除");
}
itemDao.deleteById(dto.getId()); itemDao.deleteById(dto.getId());
UserItemsRelation userItemsRelation = itemDao.find(dto.getId()); UserItemsRelation userItemsRelation = itemDao.find(dto.getId());
if (Objects.nonNull(userItemsRelation)) { if (Objects.nonNull(userItemsRelation)) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment