From 8f3bf7050e65fdbe55eaad74fde307c57dab960e Mon Sep 17 00:00:00 2001
From: 云 <2163098428@qq.com>
Date: 星期五, 24 七月 2026 17:25:55 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/dev_business' into dev_business
---
yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/api/storage/StorageAttachmentApiImpl.java | 62 +++++++++++++++++++++++++++++++
1 files changed, 62 insertions(+), 0 deletions(-)
diff --git a/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/api/storage/StorageAttachmentApiImpl.java b/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/api/storage/StorageAttachmentApiImpl.java
new file mode 100644
index 0000000..914c89d
--- /dev/null
+++ b/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/api/storage/StorageAttachmentApiImpl.java
@@ -0,0 +1,62 @@
+package cn.iocoder.yudao.module.system.api.storage;
+
+import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
+import cn.iocoder.yudao.module.system.api.storage.dto.StorageBlobRespDTO;
+import cn.iocoder.yudao.module.system.controller.admin.storage.vo.SystemStorageAttachmentListReqVO;
+import cn.iocoder.yudao.module.system.controller.admin.storage.vo.SystemStorageAttachmentSaveReqVO;
+import cn.iocoder.yudao.module.system.controller.admin.storage.vo.SystemStorageBlobRespVO;
+import cn.iocoder.yudao.module.system.service.storage.SystemStorageAttachmentService;
+import jakarta.annotation.Resource;
+import org.springframework.stereotype.Service;
+
+import java.util.ArrayList;
+import java.util.List;
+
+@Service
+public class StorageAttachmentApiImpl implements StorageAttachmentApi {
+
+ @Resource
+ private SystemStorageAttachmentService systemStorageAttachmentService;
+
+ @Override
+ public void bindAttachments(String application, String recordType, Long recordId, List<Long> blobIds) {
+ if (blobIds == null || blobIds.isEmpty()) {
+ return;
+ }
+ SystemStorageAttachmentSaveReqVO reqVO = new SystemStorageAttachmentSaveReqVO();
+ reqVO.setApplication(application != null ? application : "file");
+ reqVO.setRecordType(recordType);
+ reqVO.setRecordId(recordId);
+ List<SystemStorageAttachmentSaveReqVO.BlobItem> blobItems = new ArrayList<>();
+ for (Long blobId : blobIds) {
+ SystemStorageAttachmentSaveReqVO.BlobItem item = new SystemStorageAttachmentSaveReqVO.BlobItem();
+ item.setBlobId(blobId);
+ blobItems.add(item);
+ }
+ reqVO.setBlobItems(blobItems);
+ systemStorageAttachmentService.bindAttachments(reqVO);
+ }
+
+ @Override
+ public List<StorageBlobRespDTO> listAttachments(String recordType, Long recordId) {
+ SystemStorageAttachmentListReqVO reqVO = new SystemStorageAttachmentListReqVO();
+ reqVO.setRecordType(recordType);
+ reqVO.setRecordId(recordId);
+ List<SystemStorageBlobRespVO> list = systemStorageAttachmentService.listAttachments(reqVO);
+ return BeanUtils.toBean(list, StorageBlobRespDTO.class);
+ }
+
+ @Override
+ public void deleteAttachments(List<Long> attachmentIds) {
+ if (attachmentIds == null || attachmentIds.isEmpty()) {
+ return;
+ }
+ systemStorageAttachmentService.deleteAttachments(attachmentIds);
+ }
+
+ @Override
+ public void deleteAttachmentsByRecord(String recordType, Long recordId) {
+ systemStorageAttachmentService.deleteAttachmentsByRecordTypeAndRecordId(recordType, recordId);
+ }
+
+}
--
Gitblit v1.9.3