huminmin
4 天以前 7591ba21194595cc8d9a1293dfdbfa945bc9948f
yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/util/storage/StorageFileUtil.java
@@ -41,7 +41,7 @@
 * - token使用次数控制(Redis)
 * - 图片压缩
 *
 * @author 芋道源码
 * @author 超级管理员
 */
@Component
@RequiredArgsConstructor
@@ -104,21 +104,20 @@
            throw new IllegalArgumentException("关联记录id不能为空");
        }
        // 删除旧附件信息
        // 只删除旧的附件关联记录,保留 blob 记录(文件本身不删除)
        if (application == null || application.trim().isEmpty()) {
            for (SystemStorageAttachmentSaveReqVO.BlobItem item : blobItems) {
                String itemApp = item.getApplication();
                if (itemApp == null || itemApp.trim().isEmpty()) {
                    throw new IllegalArgumentException("文件用途不能为空");
                }
                deleteStorageAttachmentsByApplicationAndRecordTypeAndRecordId(itemApp, recordType.getType(), recordId);
                storageAttachmentMapper.deleteByApplicationAndRecordTypeAndRecordId(itemApp, recordType.getType(), recordId);
            }
        } else {
            deleteStorageAttachmentsByApplicationAndRecordTypeAndRecordId(application, recordType.getType(), recordId);
            storageAttachmentMapper.deleteByApplicationAndRecordTypeAndRecordId(application, recordType.getType(), recordId);
        }
        if (CollUtil.isEmpty(blobItems)) {
            deleteStorageAttachmentsByRecordTypeAndRecordId(recordType.getType(), recordId);
            return;
        }