From 811b3a6e9e584b5e85145707b8f220d1e3965943 Mon Sep 17 00:00:00 2001
From: liu <2021943741@qq.com>
Date: 星期二, 29 九月 2026 13:51:08 +0800
Subject: [PATCH] feat(wxcp): 新增企业微信模块,支持成员扫码登录、活动通知与通讯录

---
 yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/util/storage/StorageFileUtil.java |   15 ++++++++-------
 1 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/util/storage/StorageFileUtil.java b/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/util/storage/StorageFileUtil.java
index abc79c1..c4854fd 100644
--- a/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/util/storage/StorageFileUtil.java
+++ b/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/util/storage/StorageFileUtil.java
@@ -41,7 +41,7 @@
  * - token浣跨敤娆℃暟鎺у埗锛圧edis锛�
  * - 鍥剧墖鍘嬬缉
  *
- * @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;
         }
 
@@ -279,7 +278,8 @@
         List<SystemStorageAttachmentDO> attachments = getStorageAttachmentsByApplicationAndRecordTypeAndRecordId(
                 application, recordType, recordId);
         if (CollUtil.isEmpty(attachments)) {
-            return null;
+            // 杩斿洖绌洪泦鍚堣�岄潪 null锛氳皟鐢ㄦ柟甯告妸瀹冪洿鎺ュ杩� Collectors.toMap 鍋氬垎缁勶紙value 涓� null 浼氭姏 NPE锛�
+            return new ArrayList<>();
         }
         Map<Long, Long> blobIdToAttachmentIdMap = attachments.stream()
                 .collect(Collectors.toMap(SystemStorageAttachmentDO::getStorageBlobId, SystemStorageAttachmentDO::getId));
@@ -303,7 +303,8 @@
     public List<SystemStorageBlobRespVO> getStorageBlobVOsByRecordTypeAndRecordId(String recordType, Long recordId) {
         List<SystemStorageAttachmentDO> attachments = getStorageAttachmentsByRecordTypeAndRecordId(recordType, recordId);
         if (CollUtil.isEmpty(attachments)) {
-            return null;
+            // 杩斿洖绌洪泦鍚堣�岄潪 null锛岄伩鍏嶈皟鐢ㄦ柟鐩存帴浣跨敤杩斿洖鍊兼椂鎶� NPE
+            return new ArrayList<>();
         }
         List<Long> storageBlobIds = attachments.stream()
                 .map(SystemStorageAttachmentDO::getStorageBlobId)

--
Gitblit v1.9.3