From c93fc713fedb68cc96f6f29e0442d949b44b7caa Mon Sep 17 00:00:00 2001
From: zss <zss@example.com>
Date: 星期四, 30 四月 2026 17:37:16 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/dev_New_pro' into dev_New_pro

---
 src/main/java/com/ruoyi/basic/service/impl/StorageAttachmentServiceImpl.java |   48 +++++++++++++++++-------------------------------
 1 files changed, 17 insertions(+), 31 deletions(-)

diff --git a/src/main/java/com/ruoyi/basic/service/impl/StorageAttachmentServiceImpl.java b/src/main/java/com/ruoyi/basic/service/impl/StorageAttachmentServiceImpl.java
index f3f3ae3..fda9f26 100644
--- a/src/main/java/com/ruoyi/basic/service/impl/StorageAttachmentServiceImpl.java
+++ b/src/main/java/com/ruoyi/basic/service/impl/StorageAttachmentServiceImpl.java
@@ -1,15 +1,18 @@
 package com.ruoyi.basic.service.impl;
 
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ruoyi.basic.dto.StorageAttachmentDTO;
+import com.ruoyi.basic.dto.StorageBlobVO;
+import com.ruoyi.basic.enums.RecordTypeEnum;
 import com.ruoyi.basic.mapper.StorageAttachmentMapper;
 import com.ruoyi.basic.mapper.StorageBlobMapper;
 import com.ruoyi.basic.pojo.StorageAttachment;
 import com.ruoyi.basic.service.StorageAttachmentService;
 import com.ruoyi.basic.service.StorageBlobService;
-import com.ruoyi.common.constant.StorageAttachmentConstants;
-import com.ruoyi.common.enums.StorageAttachmentRecordType;
+import com.ruoyi.basic.utils.FileUtil;
 import lombok.RequiredArgsConstructor;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
 
 import java.util.List;
 
@@ -29,40 +32,17 @@
     private final StorageAttachmentMapper storageAttachmentMapper;
 
     private final StorageBlobService storageBlobService;
-
+    private final FileUtil fileUtil;
 
     @Override
-    public void saveStorageAttachment(List<StorageAttachment> attachments, Long recordId, StorageAttachmentRecordType recordType, StorageAttachmentConstants fileType) {
-        // 鍒犻櫎鏃у浘
-        // todo fileChange
-//        deleteStorageAttachment(new StorageAttachment(fileType.toString(), (long) recordType.ordinal(), recordId));
-//        for (StorageAttachment attachment : attachments) {
-//            // 鑾峰彇鍏宠仈璁板綍
-//            StorageBlob storageBlob = attachment.getStorageBlobDTO();
-//            attachment.setName(fileType.toString());
-//            attachment.setRecordType((long) recordType.ordinal());
-//            attachment.setRecordId(recordId);
-//            attachment.setStorageBlobId(storageBlob.getId());
-//            storageAttachmentMapper.insert(attachment);
-//        }
-
+    @Transactional(rollbackFor = Exception.class)
+    public void saveStorageAttachment(StorageAttachmentDTO storageAttachmentDTO) {
+        fileUtil.saveStorageAttachmentByRecordTypeAndRecordId(storageAttachmentDTO.getApplication(), RecordTypeEnum.getByType(storageAttachmentDTO.getRecordType()), storageAttachmentDTO.getRecordId(), storageAttachmentDTO.getStorageBlobDTOs());
     }
 
     @Override
-    public void saveStorageAttachment(List<StorageAttachment> attachments, Long recordId, StorageAttachmentRecordType recordType, String fileType) {
-        // 鍒犻櫎鏃у浘
-//        deleteStorageAttachment(new StorageAttachment(fileType, (long) recordType.ordinal(), recordId));
-        // todo fileChange
-//        for (StorageAttachment attachment : attachments) {
-//            // 鑾峰彇鍏宠仈璁板綍
-//            StorageBlob storageBlob = attachment.getStorageBlobDTO();
-//            attachment.setName(fileType);
-//            attachment.setRecordType((long) recordType.ordinal());
-//            attachment.setRecordId(recordId);
-//            attachment.setStorageBlobId(storageBlob.getId());
-//            storageAttachmentMapper.insert(attachment);
-//        }
-
+    public List<StorageBlobVO> list(StorageAttachmentDTO storageAttachmentDTO) {
+        return fileUtil.getStorageBlobVOsByApplicationAndRecordTypeAndRecordId(storageAttachmentDTO);
     }
 
     @Override
@@ -79,4 +59,10 @@
 //    }
         return 0;
     }
+
+    @Override
+    public int batchDeleteStorageAttachment(List<Long> ids) {
+        fileUtil.deleteStorageAttachmentsByStorageAttachmentIds(ids);
+        return 1;
+    }
 }

--
Gitblit v1.9.3