1
0
mirror of https://gitee.com/bookshelfplus/bookshelfplus synced 2025-09-25 19:05:14 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee

前端对象列表页面;文件对象管理页面后端Api;后端Api添加管理员身份验证

This commit is contained in:
2022-04-10 21:12:15 +08:00
parent 413411ddb6
commit c3139a6908
17 changed files with 326 additions and 88 deletions

View File

@@ -1,11 +1,14 @@
package plus.bookshelf.Service.Impl;
import lombok.SneakyThrows;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;
import plus.bookshelf.Dao.DO.FileDO;
import plus.bookshelf.Dao.Mapper.FileDOMapper;
import plus.bookshelf.Service.Model.FileModel;
import plus.bookshelf.Service.Model.UserModel;
import plus.bookshelf.Service.Service.FileService;
import java.lang.reflect.InvocationTargetException;
@@ -18,13 +21,24 @@ public class FileServiceImpl implements FileService {
@Autowired
FileDOMapper fileDOMapper;
@Autowired
RedisTemplate redisTemplate;
@Autowired
UserServiceImpl userService;
/**
* 列出所有文件
*
* @return
*/
@SneakyThrows
@Override
public List<FileModel> list() throws InvocationTargetException, IllegalAccessException {
public List<FileModel> list(String token) throws InvocationTargetException, IllegalAccessException {
// 已经在 getUserByToken 方法中判断了 token 为空、不合法;用户不存在情况,此处无需再判断
UserModel userModel = userService.getUserByToken(redisTemplate, token);
FileDO[] fileDOS = fileDOMapper.selectAll();
List<FileModel> fileModels = new ArrayList<>();