From 7424b29a429d58d511676e045b0928cd97b13973 Mon Sep 17 00:00:00 2001
From: yupeng <roc__yu@163.com>
Date: 星期五, 07 三月 2025 15:25:57 +0800
Subject: [PATCH] feat: 上传文件存库

---
 ruoyi-admin/src/main/java/com/ruoyi/web/controller/tool/TencentCosUtil.java |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/tool/TencentCosUtil.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/tool/TencentCosUtil.java
index 3834733..3133f3a 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/tool/TencentCosUtil.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/tool/TencentCosUtil.java
@@ -138,6 +138,14 @@
             objectMetadata.setContentType(fileType);
             //上传文件
             PutObjectResult putResult = cosClient.putObject(cosConfig.getBucketName(), filePath, inputStream, objectMetadata);
+            TFile tFile = new TFile();
+            tFile.setFileName(filePath);
+            tFile.setRealName(originalFilename);
+            tFile.setFileType(fileType);
+            tFile.setUrl(cosConfig.getRootSrc()+filePath);
+            tFile.setContentType(file.getContentType());
+            tFile.setFileSize(file.getSize());
+            sysFileService.save(tFile);
             // 创建文件的网络访问路径
             String url = cosConfig.getRootSrc() + filePath;
             return url;

--
Gitblit v1.7.1