| | |
| | | import com.ruoyi.common.core.domain.AjaxResult; |
| | | import com.ruoyi.file.constants.FileProjectConstants; |
| | | import com.ruoyi.file.service.AttachmentService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | |
| | | * @date: 2023/8/29 |
| | | * @time: 10:53 |
| | | */ |
| | | @Api(tags = "附件") |
| | | @RestController |
| | | @RequestMapping("attachment") |
| | | public class AttachmentController extends BaseController { |
| | |
| | | * @param key |
| | | * @return |
| | | */ |
| | | |
| | | @ApiOperation(value = "根据标识查询文件具体信息") |
| | | @GetMapping("/get/key/{key}") |
| | | public AjaxResult findByKey(@PathVariable String key) { |
| | | return success(attachmentService.findByKey(key)); |
| | |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @ApiOperation(value = "删除文件数据") |
| | | @GetMapping("/delete/{id}") |
| | | public AjaxResult delete(@PathVariable Long id) { |
| | | attachmentService.delete(id); |
| | |
| | | * @Description 上传文件(返回文件标识) |
| | | * @Param [file, module] |
| | | **/ |
| | | |
| | | @ApiOperation(value = "上传文件(返回文件标识)") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "file", value = "文件",required = true), |
| | | @ApiImplicitParam(name = "module", dataTypeClass = String.class,value = "模块",required = true,example = "accountPath"), |
| | | }) |
| | | @PostMapping("/upload/key") |
| | | public AjaxResult uploadReturnKey(@RequestParam("file") MultipartFile |
| | | file, @RequestParam("module") String module) { |
| | |
| | | * @Description 上传文件(返回文件信息) |
| | | * @Param [file, module] |
| | | **/ |
| | | @ApiOperation(value = "上传文件(返回文件信息)") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "file",value = "文件",required = true), |
| | | @ApiImplicitParam(name = "module", dataTypeClass = String.class,value = "模块",required = true,example = "accountPath"), |
| | | }) |
| | | @PostMapping("/upload/detail") |
| | | public AjaxResult uploadReturnDetail(@RequestParam("file") MultipartFile |
| | | file, @RequestParam("module") String module) { |
| | |
| | | * @Date 2021/4/20 19:28 |
| | | * @Param [file, module] |
| | | **/ |
| | | @ApiOperation(value = "上传文件(返回访问路径)") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "file",value = "文件",required = true), |
| | | @ApiImplicitParam(name = "module", dataTypeClass = String.class,value = "模块",required = true,example = "accountPath"), |
| | | }) |
| | | @PostMapping("/upload/url") |
| | | public AjaxResult uploadReturnUrl(@RequestParam("file") MultipartFile file, @RequestParam("module") String module) { |
| | | return success(attachmentService.saveFileToPath(file, module, FileProjectConstants.ReturnType.URL)); |
| | |
| | | * @Description 上传文件(返回文件信息) |
| | | * @Param [file, module] |
| | | **/ |
| | | @ApiOperation(value = "批量上传文件(返回文件信息)") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "file", value = "文件",required = true), |
| | | @ApiImplicitParam(name = "module", dataTypeClass = String.class,value = "模块",required = true,example = "accountPath"), |
| | | }) |
| | | @PostMapping("/upload/batch/detail") |
| | | public AjaxResult uploadBatchReturnDetail(@RequestParam("file") MultipartFile[] |
| | | file, @RequestParam("module") String module) { |