Search in sources :

Example 1 with FileListVo

use of com.qiwenshare.file.vo.file.FileListVo in project qiwen-file by qiwenshare.

the class CommonFileController method commonFileList.

@Operation(summary = "获取共享用户文件列表", description = "用来做前台列表展示", tags = { "file" })
@RequestMapping(value = "/commonFileList", method = RequestMethod.GET)
@ResponseBody
public RestResult<FileListVo> commonFileList(@Parameter(description = "用户id", required = true) Long commonFileId, @Parameter(description = "文件路径", required = true) String filePath, @Parameter(description = "当前页", required = true) long currentPage, @Parameter(description = "页面数量", required = true) long pageCount) {
    CommonFile commonFile = commonFileService.getById(commonFileId);
    UserFile userFile = userFileService.getById(commonFile.getUserFileId());
    filePath = userFile.getFilePath() + filePath;
    IPage<FileListVo> fileList = userFileService.userFileList(userFile.getUserId(), filePath, currentPage, pageCount);
    return RestResult.success().data(fileList);
}
Also used : CommonFile(com.qiwenshare.file.domain.CommonFile) UserFile(com.qiwenshare.file.domain.UserFile) CommonFileListVo(com.qiwenshare.file.vo.commonfile.CommonFileListVo) FileListVo(com.qiwenshare.file.vo.file.FileListVo) Operation(io.swagger.v3.oas.annotations.Operation)

Example 2 with FileListVo

use of com.qiwenshare.file.vo.file.FileListVo in project qiwen-file by qiwenshare.

the class UserFileService method userFileList.

@Override
public IPage<FileListVo> userFileList(Long userId, String filePath, Long currentPage, Long pageCount) {
    Page<FileListVo> page = new Page<>(currentPage, pageCount);
    UserFile userFile = new UserFile();
    JwtUser sessionUserBean = SessionUtil.getSession();
    if (userId == null) {
        userFile.setUserId(sessionUserBean.getUserId());
    } else {
        userFile.setUserId(userId);
    }
    userFile.setFilePath(UFOPUtils.urlDecode(filePath));
    return userFileMapper.selectPageVo(page, userFile, null);
}
Also used : UserFile(com.qiwenshare.file.domain.UserFile) Page(com.baomidou.mybatisplus.extension.plugins.pagination.Page) IPage(com.baomidou.mybatisplus.core.metadata.IPage) JwtUser(com.qiwenshare.common.util.security.JwtUser) FileListVo(com.qiwenshare.file.vo.file.FileListVo)

Example 3 with FileListVo

use of com.qiwenshare.file.vo.file.FileListVo in project qiwen-file by qiwenshare.

the class FileController method selectFileByFileType.

@Operation(summary = "通过文件类型选择文件", description = "该接口可以实现文件格式分类查看", tags = { "file" })
@RequestMapping(value = "/selectfilebyfiletype", method = RequestMethod.GET)
@ResponseBody
public RestResult<List<Map<String, Object>>> selectFileByFileType(@Parameter(description = "文件类型", required = true) int fileType, @Parameter(description = "当前页", required = true) @RequestParam(defaultValue = "1") long currentPage, @Parameter(description = "页面数量", required = true) @RequestParam(defaultValue = "10") long pageCount) {
    JwtUser sessionUserBean = SessionUtil.getSession();
    long userId = sessionUserBean.getUserId();
    IPage<FileListVo> result = userFileService.getFileByFileType(fileType, currentPage, pageCount, userId);
    Map<String, Object> map = new HashMap<>();
    map.put("list", result.getRecords());
    map.put("total", result.getTotal());
    return RestResult.success().data(map);
}
Also used : JwtUser(com.qiwenshare.common.util.security.JwtUser) FileListVo(com.qiwenshare.file.vo.file.FileListVo) Operation(io.swagger.v3.oas.annotations.Operation)

Example 4 with FileListVo

use of com.qiwenshare.file.vo.file.FileListVo in project qiwen-file by qiwenshare.

the class UserFileService method getFileByFileType.

@Override
public IPage<FileListVo> getFileByFileType(Integer fileTypeId, Long currentPage, Long pageCount, long userId) {
    Page<FileListVo> page = new Page<>(currentPage, pageCount);
    UserFile userFile = new UserFile();
    userFile.setUserId(userId);
    return userFileMapper.selectPageVo(page, userFile, fileTypeId);
}
Also used : UserFile(com.qiwenshare.file.domain.UserFile) Page(com.baomidou.mybatisplus.extension.plugins.pagination.Page) IPage(com.baomidou.mybatisplus.core.metadata.IPage) FileListVo(com.qiwenshare.file.vo.file.FileListVo)

Aggregations

FileListVo (com.qiwenshare.file.vo.file.FileListVo)4 UserFile (com.qiwenshare.file.domain.UserFile)3 IPage (com.baomidou.mybatisplus.core.metadata.IPage)2 Page (com.baomidou.mybatisplus.extension.plugins.pagination.Page)2 JwtUser (com.qiwenshare.common.util.security.JwtUser)2 Operation (io.swagger.v3.oas.annotations.Operation)2 CommonFile (com.qiwenshare.file.domain.CommonFile)1 CommonFileListVo (com.qiwenshare.file.vo.commonfile.CommonFileListVo)1