修改查询条件
parent
52536f550d
commit
9e20fc9943
|
|
@ -29,27 +29,36 @@ public class FireDeviceRemoveExe {
|
|||
if (fireDeviceDO == null) {
|
||||
throw new BizException("设备不存在");
|
||||
}
|
||||
boolean res = fireDeviceGateway.deletedFireDeviceById(id);
|
||||
if (!res) {
|
||||
throw new BizException("删除失败");
|
||||
}
|
||||
//TODO 级联删除关联的检查表记录
|
||||
|
||||
Long count = fireCheckListItemRepository.countByDeviceId(fireDeviceDO.getFireDeviceId());
|
||||
if(count>0){
|
||||
throw new BizException("请先删除关联的检查表记录");
|
||||
}
|
||||
boolean res = fireDeviceGateway.deletedFireDeviceById(id);
|
||||
if (!res) {
|
||||
throw new BizException("删除失败");
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean execute(Long[] ids) {
|
||||
for (Long id : ids) {
|
||||
FireDeviceDO fireDeviceDO = fireDeviceRepository.getById( id);
|
||||
if (fireDeviceDO == null) {
|
||||
throw new BizException("设备不存在");
|
||||
}
|
||||
|
||||
Long count = fireCheckListItemRepository.countByDeviceId(fireDeviceDO.getFireDeviceId());
|
||||
if(count>0){
|
||||
throw new BizException(fireDeviceDO.getFireDeviceCode()+"请先删除关联的检查表记录");
|
||||
}
|
||||
}
|
||||
boolean res = fireDeviceGateway.deletedFireDeviceByIds(ids);
|
||||
if (!res) {
|
||||
throw new BizException("删除失败");
|
||||
}
|
||||
//TODO 级联删除关联的检查表记录
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue