设为首页 加入收藏

TOP

第2-3-7章 个人网盘服务接口开发-文件存储服务系统-nginx/fastDFS/minio/阿里云oss/七牛云oss(二)
2023-07-25 21:33:33 】 浏览:125
Tags:2-3-7 文件存 储服务 -nginx/fastDFS/minio/ oss/ 牛云 oss
port com.baomidou.mybatisplus.core.metadata.IPage; import com.itheima.pinda.base.BaseController; import com.itheima.pinda.base.R; import com.itheima.pinda.dozer.DozerUtils; import com.itheima.pinda.file.dto.FilePageReqDTO; import com.itheima.pinda.file.dto.FileUpdateDTO; import com.itheima.pinda.file.dto.FolderDTO; import com.itheima.pinda.file.dto.FolderSaveDTO; import com.itheima.pinda.file.entity.File; import com.itheima.pinda.file.manager.FileRestManager; import com.itheima.pinda.file.service.FileService; import com.itheima.pinda.log.annotation.SysLog; import io.swagger.annotations.*; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.validation.Valid; import javax.validation.constraints.NotNull; /** * 文件前端控制器 */ @Validated @RestController @RequestMapping("/file") @Slf4j @Api(value = "文件表", tags = "文件表") public class FileController extends BaseController { @Autowired private FileService fileService; @Autowired private FileRestManager fileRestManager; @Autowired private DozerUtils dozerUtils; /** * 查询单个文件信息 * * @param id * @return */ @ApiOperation(value = "查询文件", notes = "查询文件") @GetMapping public R<File> get(@RequestParam(value = "id") Long id) { File file = fileService.getById(id); if (file != null && file.getIsDelete()) { return success(null); } return success(file); } /** * 获取文件分页 */ @ApiOperation(value = "分页查询文件", notes = "获取文件分页") @ApiImplicitParams({ @ApiImplicitParam(name = "current", value = "当前页", dataType = "long", paramType = "query", defaultValue = "1"), @ApiImplicitParam(name = "size", value = "每页显示几条", dataType = "long", paramType = "query", defaultValue = "10"), }) @GetMapping(value = "/page") public R<IPage<File>> page(FilePageReqDTO data) { return success(fileRestManager.page(getPage(), data)); } /** * 上传文件 */ @ApiOperation(value = "上传文件", notes = "上传文件 ") @ApiResponses({ @ApiResponse(code = 60102, message = "文件夹为空"), }) @ApiImplicitParams({ @ApiImplicitParam(name = "source", value = "文件来源", dataType = "String", paramType = "query"), @ApiImplicitParam(name = "userId", value = "用户id", dataType = "long", paramType = "query"), @ApiImplicitParam(name = "folderId", value = "文件夹id", dataType = "long", paramType = "query"), @ApiImplicitParam(name = "file", value = "附件", dataType = "MultipartFile", allowMultiple = true, required = true), }) @RequestMapping(value = "/upload", method = RequestMethod.POST) public R<File> upload( @NotNull(messag
首页 上一页 1 2 3 4 5 6 7 下一页 尾页 2/11/11
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇Mybatis 入门实战(2)--简单使用 下一篇框架进行时——SpringMVC流程简析..

最新文章

热门文章

Hot 文章

Python

C 语言

C++基础

大数据基础

linux编程基础

C/C++面试题目