|
@@ -38,9 +38,7 @@ public class FilesServiceImpl extends ServiceImpl<FilesMapper, FilesUpload> impl
|
|
|
public FileUploadResponse upload(MultipartFile file) {
|
|
|
|
|
|
// 获取当前登录用户昵称(如果可用)
|
|
|
-// String userName = getUserNameFromSecurityContext();
|
|
|
- String userName = SecurityUtils.getUsername();
|
|
|
- System.out.println("当前登录用户昵称:" + userName);
|
|
|
+ String userName = getUserNameFromSecurityContext();
|
|
|
|
|
|
// 文件夹路径名称
|
|
|
String originalFilename = file.getOriginalFilename();
|
|
@@ -239,6 +237,9 @@ public class FilesServiceImpl extends ServiceImpl<FilesMapper, FilesUpload> impl
|
|
|
queryWrapper.eq("type", fileType);
|
|
|
}
|
|
|
|
|
|
+ // 按照创建时间倒序排列
|
|
|
+ queryWrapper.orderByDesc("create_time");
|
|
|
+
|
|
|
return page(page, queryWrapper);
|
|
|
}
|
|
|
|
|
@@ -247,8 +248,6 @@ public class FilesServiceImpl extends ServiceImpl<FilesMapper, FilesUpload> impl
|
|
|
return SecurityUtils.getUsername();
|
|
|
} catch (Exception e) {
|
|
|
// 如果无法获取用户信息,记录日志并返回默认值或抛出自定义异常
|
|
|
- log.error("无法获取用户信息");
|
|
|
- System.out.println("无法获取用户信息");
|
|
|
return "未知用户";
|
|
|
}
|
|
|
}
|