| | |
| | | if (CollUtil.isEmpty(storageBlobIds)) { |
| | | return; |
| | | } |
| | | // 生产工单依赖原始文件反映历史版本,不允许通过其他附件入口删除这些共享文件。 |
| | | Long snapshotReferences = storageAttachmentMapper.selectCount( |
| | | new com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper<SystemStorageAttachmentDO>() |
| | | .eq(SystemStorageAttachmentDO::getRecordType, "mes_work_order_technical_file") |
| | | .in(SystemStorageAttachmentDO::getStorageBlobId, storageBlobIds)); |
| | | if (snapshotReferences != null && snapshotReferences > 0) { |
| | | throw new cn.iocoder.yudao.framework.common.exception.ServiceException(400, "技术文件已被生产工单留存,不能删除"); |
| | | } |
| | | // 同时删除磁盘文件 |
| | | List<SystemStorageBlobDO> blobs = storageBlobMapper.selectByIds(storageBlobIds); |
| | | for (SystemStorageBlobDO blob : blobs) { |