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;