From 2ec6b477938b95608873feefa819c687d69c4a88 Mon Sep 17 00:00:00 2001
From: chenhj <1263187585@qq.com>
Date: 星期六, 25 四月 2026 15:09:56 +0800
Subject: [PATCH] Merge branch 'dev_New_pro' of http://114.132.189.42:9002/r/product-inventory-management-after into dev_New_pro

---
 src/main/java/com/ruoyi/basic/utils/FileUtil.java |   43 +++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 43 insertions(+), 0 deletions(-)

diff --git a/src/main/java/com/ruoyi/basic/utils/FileUtil.java b/src/main/java/com/ruoyi/basic/utils/FileUtil.java
index 97397f3..fde28b4 100644
--- a/src/main/java/com/ruoyi/basic/utils/FileUtil.java
+++ b/src/main/java/com/ruoyi/basic/utils/FileUtil.java
@@ -1,7 +1,10 @@
 package com.ruoyi.basic.utils;
 
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ruoyi.basic.dto.StorageAttachmentDTO;
 import com.ruoyi.basic.dto.StorageAttachmentVO;
 import com.ruoyi.basic.dto.StorageBlobDTO;
 import com.ruoyi.basic.dto.StorageBlobVO;
@@ -198,6 +201,46 @@
     }
 
     /**
+     * 閫氳繃璁板綍绫诲瀷鑾峰彇鏂囦欢淇℃伅 attachment锛堝垎椤碉級
+     *
+     * @param page       鍒嗛〉鍙傛暟
+     * @param storageAttachmentDTO 鍏宠仈璁板綍淇℃伅
+     */
+    public IPage<StorageAttachmentVO> getStorageAttachmentVosPageListByApplicationAndRecordTypeAndRecordId(Page page, StorageAttachmentDTO storageAttachmentDTO) {
+        // 鍒嗛〉鏌ヨ绗﹀悎鏉′欢鐨� StorageAttachment 璁板綍
+        LambdaQueryWrapper<StorageAttachment> queryWrapper = new LambdaQueryWrapper<StorageAttachment>()
+                .eq(StorageAttachment::getRecordType, storageAttachmentDTO.getRecordType())
+                .eq(StorageAttachment::getRecordId, storageAttachmentDTO.getRecordId());
+        if (storageAttachmentDTO.getApplication() != null) {
+            queryWrapper.eq(StorageAttachment::getApplication, storageAttachmentDTO.getApplication());
+        }
+        IPage<StorageAttachmentVO> storageAttachmentIPage = storageAttachmentMapper.selectPage(page, queryWrapper);
+
+        // 杞崲涓� StorageAttachmentVO 骞惰幏鍙栧搴旂殑 StorageBlobVO
+        List<StorageAttachmentVO> storageAttachmentVOS = new ArrayList<>();
+        if (CollectionUtils.isNotEmpty(storageAttachmentIPage.getRecords())) {
+            for (StorageAttachment storageAttachment : storageAttachmentIPage.getRecords()) {
+                StorageAttachmentVO storageAttachmentVO = new StorageAttachmentVO();
+                BeanUtils.copyProperties(storageAttachment, storageAttachmentVO);
+                List<StorageBlobVO> storageBlobVOS = getStorageBlobVOsByStorageAttachmentIds(Collections.singletonList(storageAttachment.getId()));
+                if (CollectionUtils.isEmpty(storageBlobVOS)) {
+                    storageAttachmentVO.setStorageBlobVOS(new ArrayList<>());
+                } else {
+                    storageAttachmentVO.setStorageBlobVOS(storageBlobVOS);
+                }
+                storageAttachmentVOS.add(storageAttachmentVO);
+            }
+        }
+
+        // 鏋勫缓鍒嗛〉缁撴灉
+        IPage<StorageAttachmentVO> resultPage = new Page<>();
+        BeanUtils.copyProperties(storageAttachmentIPage, resultPage);
+        resultPage.setRecords(storageAttachmentVOS);
+
+        return resultPage;
+    }
+
+    /**
      * 閫氳繃鏂囦欢鐢ㄩ�斻�佸叧鑱旇褰曠被鍨嬨�佸叧鑱旇褰昳d鑾峰彇鏂囦欢鍏宠仈淇℃伅 attachment
      *
      * @param application 鏂囦欢鐢ㄩ��

--
Gitblit v1.9.3