From 2b57a4f1bae02866ea4769e74ec0bb558afc960e Mon Sep 17 00:00:00 2001 From: zhangsiqi <2825463979@qq.com> Date: Wed, 15 May 2024 19:36:33 +0800 Subject: [PATCH] =?UTF-8?q?[feat]=E9=80=9A=E7=94=A8=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E6=96=B9=E6=B3=95=EF=BC=8C=E6=B7=BB=E5=8A=A0=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E7=94=A8=E6=88=B7=EF=BC=8C=E4=B8=8A=E4=BC=A0?= =?UTF-8?q?=E6=97=B6=E9=97=B4=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/ruoyi/common/service/impl/CommonServiceImpl.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/common/service/impl/CommonServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/common/service/impl/CommonServiceImpl.java index c6f2c680..1b28df27 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/common/service/impl/CommonServiceImpl.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/common/service/impl/CommonServiceImpl.java @@ -3,7 +3,10 @@ package com.ruoyi.common.service.impl; import com.ruoyi.common.config.RuoYiConfig; import com.ruoyi.common.config.ServerConfig; import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.domain.entity.SysUser; import com.ruoyi.common.service.ICommonService; +import com.ruoyi.common.utils.DateUtils; +import com.ruoyi.common.utils.ShiroUtils; import com.ruoyi.common.utils.file.FileUploadUtils; import com.ruoyi.common.utils.file.FileUtils; import com.ruoyi.system.domain.SysAttach; @@ -84,6 +87,7 @@ public class CommonServiceImpl implements ICommonService { public AjaxResult uploadSingleFile(MultipartFile file) { try { + String loginName = ShiroUtils.getLoginName(); // 上传文件路径 String filePath = RuoYiConfig.getUploadPath(); // 上传并返回新文件名称 @@ -99,6 +103,8 @@ public class CommonServiceImpl implements ICommonService { sysAttachFile.setSize(fileSize); sysAttachFile.setExt(fileExt); sysAttachFile.setPath(fileName); + sysAttachFile.setCreateBy(loginName); + sysAttachFile.setCreateTime(DateUtils.getNowDate()); attachFileService.insertSysAttachFile(sysAttachFile); AjaxResult ajax = AjaxResult.success(sysAttachFile); return ajax;