From c1babcfa8a9cd01dbeb8527a6a95cbcc431957c7 Mon Sep 17 00:00:00 2001
From: liding <756868258@qq.com>
Date: 星期三, 22 四月 2026 10:42:35 +0800
Subject: [PATCH] fix:生产模块

---
 src/main/java/com/ruoyi/basic/service/impl/StorageAttachmentServiceImpl.java |   97 +++++++++++++++++++++++++-----------------------
 1 files changed, 50 insertions(+), 47 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 d0e4b70..1682d90 100644
--- a/src/main/java/com/ruoyi/basic/service/impl/StorageAttachmentServiceImpl.java
+++ b/src/main/java/com/ruoyi/basic/service/impl/StorageAttachmentServiceImpl.java
@@ -1,19 +1,15 @@
 package com.ruoyi.basic.service.impl;
 
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.ruoyi.basic.dto.StorageBlobDTO;
-import com.ruoyi.basic.pojo.StorageAttachment;
 import com.ruoyi.basic.mapper.StorageAttachmentMapper;
 import com.ruoyi.basic.mapper.StorageBlobMapper;
-import com.ruoyi.basic.pojo.StorageBlob;
+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.common.utils.MinioUtils;
 import lombok.RequiredArgsConstructor;
-import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
@@ -43,65 +39,72 @@
     private MinioUtils minioUtils;
 
     @Override
-    public List<StorageAttachment> selectStorageAttachments(Long recordId, StorageAttachmentRecordType recordType, StorageAttachmentConstants fileType) {
-        List<StorageAttachment> storageAttachments = storageAttachmentMapper.selectList(new LambdaQueryWrapper<StorageAttachment>()
-                .eq(StorageAttachment::getRecordId, recordId)
-                .eq(StorageAttachment::getRecordType, recordType.ordinal())
-                .eq(StorageAttachment::getName, fileType.toString()));
-        if (storageAttachments != null) {
-            for (StorageAttachment storageAttachment : storageAttachments) {
-                StorageBlob storageBlob = storageBlobMapper.selectById(storageAttachment.getStorageBlobId());
-                StorageBlobDTO storageBlobDTO = new StorageBlobDTO();
-                BeanUtils.copyProperties(storageBlob, storageBlobDTO);
-                storageBlobDTO.setUrl(minioUtils.getPreviewUrl(storageBlob.getBucketName(), storageBlob.getBucketName(), true));
-                storageAttachment.setStorageBlobDTO(storageBlobDTO);
-            }
-        }
+    public List<StorageAttachment> selectStorageAttachments(Long recordId, StorageAttachmentRecordType recordType, String fileType) {
+        // todo fileChange
+//        List<StorageAttachment> storageAttachments = storageAttachmentMapper.selectList(new LambdaQueryWrapper<StorageAttachment>()
+//                .eq(StorageAttachment::getRecordId, recordId)
+//                .eq(StorageAttachment::getRecordType, recordType.ordinal())
+//                .eq(StorageAttachment::getName, fileType));
+//        if (storageAttachments != null) {
+//            for (StorageAttachment storageAttachment : storageAttachments) {
+//                StorageBlob storageBlob = storageBlobMapper.selectById(storageAttachment.getStorageBlobId());
+//                StorageBlobDTO storageBlobDTO = new StorageBlobDTO();
+//                BeanUtils.copyProperties(storageBlob, storageBlobDTO);
+//                storageBlobDTO.setUrl(minioUtils.getPreviewUrl(storageBlob.getBucketName(), storageBlob.getBucketName(), true));
+//                storageAttachment.setStorageBlobDTO(storageBlobDTO);
+//            }
+//        }
 
-        return storageAttachments;
+//        return storageAttachments;
+        return null;
     }
 
     @Override
     public void saveStorageAttachment(List<StorageAttachment> attachments, Long recordId, StorageAttachmentRecordType recordType, StorageAttachmentConstants fileType) {
         // 鍒犻櫎鏃у浘
-        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);
-        }
+        // 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);
+//        }
 
     }
 
     @Override
     public void saveStorageAttachment(List<StorageAttachment> attachments, Long recordId, StorageAttachmentRecordType recordType, String fileType) {
         // 鍒犻櫎鏃у浘
-        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);
-        }
+//        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);
+//        }
 
     }
 
     @Override
     public int deleteStorageAttachment(StorageAttachment storageAttachment) {
         // 鍏堝垹闄ゆ槑缁嗚〃
-        storageBlobService.deleteStorageBlobs(storageAttachment);
-
-
-        return storageAttachmentMapper.delete(new LambdaQueryWrapper<StorageAttachment>()
-                .eq(StorageAttachment::getRecordId, storageAttachment.getRecordId())
-                .eq(StorageAttachment::getRecordType, storageAttachment.getRecordType())
-                .eq(StorageAttachment::getName, storageAttachment.getName()));
+        // todo fileChange
+//        storageBlobService.deleteStorageBlobs(storageAttachment);
+//
+//
+//        return storageAttachmentMapper.delete(new LambdaQueryWrapper<StorageAttachment>()
+//                .eq(StorageAttachment::getRecordId, storageAttachment.getRecordId())
+//                .eq(StorageAttachment::getRecordType, storageAttachment.getRecordType())
+//                .eq(StorageAttachment::getName, storageAttachment.getName()));
+//    }
+        return 0;
     }
 }

--
Gitblit v1.9.3