|
|
@ -177,19 +177,45 @@ public class PropertyManagementServiceImpl implements PropertyManagementService |
|
|
|
|
|
|
|
/** |
|
|
|
* 单个删除 |
|
|
|
* @param formDTO |
|
|
|
* @param id |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public void delete(IcPropertyManagementFormDTO formDTO) { |
|
|
|
public void delete(String id) { |
|
|
|
LambdaQueryWrapper<IcNeighborHoodPropertyEntity> queryWrapper=new LambdaQueryWrapper<>(); |
|
|
|
queryWrapper.eq(IcNeighborHoodPropertyEntity::getPropertyId,formDTO.getId()); |
|
|
|
queryWrapper.eq(IcNeighborHoodPropertyEntity::getPropertyId,id); |
|
|
|
if (icNeighborHoodPropertyDao.selectCount(queryWrapper) > 0) { |
|
|
|
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(),"物业存在与小区关联,无法删除","已与小区关联,无法删除"); |
|
|
|
} |
|
|
|
icPropertyManagementDao.deleteById(formDTO.getId()); |
|
|
|
icPropertyManagementDao.deleteById(id); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 物业管理批量删除 |
|
|
|
* @param ids |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public void deleteBatch(List<String> ids) { |
|
|
|
if (CollectionUtils.isEmpty(ids)) { |
|
|
|
return; |
|
|
|
} |
|
|
|
int failedNum = NumConstant.ZERO; |
|
|
|
for (String id : ids) { |
|
|
|
LambdaQueryWrapper<IcNeighborHoodPropertyEntity> queryWrapper = new LambdaQueryWrapper<>(); |
|
|
|
queryWrapper.eq(IcNeighborHoodPropertyEntity::getPropertyId, id); |
|
|
|
if (icNeighborHoodPropertyDao.selectCount(queryWrapper) > 0) { |
|
|
|
failedNum += 1; |
|
|
|
} else { |
|
|
|
icPropertyManagementDao.deleteById(id); |
|
|
|
} |
|
|
|
} |
|
|
|
if (failedNum > NumConstant.ZERO) { |
|
|
|
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "物业存在与小区关联,无法删除", String.format("%s个物业已与小区关联,无法批量删除,请先解除与小区关联关系", failedNum)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* 物业管理-列表查询 |
|
|
|
* |
|
|
|