| | |
| | | import com.ruoyi.system.domain.vo.SysOssVo; |
| | | import com.ruoyi.system.service.ISysConfigService; |
| | | import com.ruoyi.system.service.ISysOssService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.annotations.*; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.http.MediaType; |
| | |
| | | */ |
| | | @ApiOperation("上传OSS对象存储") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "file", value = "文件", dataType = "java.io.File", required = true), |
| | | @ApiImplicitParam(name = "file", value = "文件", dataType = "java.io.File", required = true), |
| | | }) |
| | | @PreAuthorize("@ss.hasPermi('system:oss:upload')") |
| | | @Log(title = "OSS对象存储", businessType = BusinessType.INSERT) |
| | |
| | | @ApiOperation("下载OSS对象存储") |
| | | @PreAuthorize("@ss.hasPermi('system:oss:download')") |
| | | @GetMapping("/download/{ossId}") |
| | | public void download(@PathVariable Long ossId, HttpServletResponse response) throws IOException { |
| | | public void download(@ApiParam("OSS对象ID") @PathVariable Long ossId, HttpServletResponse response) throws IOException { |
| | | SysOss sysOss = iSysOssService.getById(ossId); |
| | | if (ObjectUtil.isNull(sysOss)) { |
| | | throw new ServiceException("文件数据不存在!"); |
| | |
| | | @PreAuthorize("@ss.hasPermi('system:oss:remove')") |
| | | @Log(title = "OSS对象存储", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/{ossIds}") |
| | | public AjaxResult<Void> remove(@NotEmpty(message = "主键不能为空") |
| | | public AjaxResult<Void> remove(@ApiParam("OSS对象ID串") |
| | | @NotEmpty(message = "主键不能为空") |
| | | @PathVariable Long[] ossIds) { |
| | | return toAjax(iSysOssService.deleteWithValidByIds(Arrays.asList(ossIds), true) ? 1 : 0); |
| | | } |
| | |
| | | public AjaxResult<Void> changePreviewListResource(@RequestBody String body) { |
| | | Map<String, Boolean> map = JsonUtils.parseMap(body); |
| | | SysConfig config = iSysConfigService.getOne(new LambdaQueryWrapper<SysConfig>() |
| | | .eq(SysConfig::getConfigKey, CloudConstant.PEREVIEW_LIST_RESOURCE_KEY)); |
| | | .eq(SysConfig::getConfigKey, CloudConstant.PEREVIEW_LIST_RESOURCE_KEY)); |
| | | config.setConfigValue(map.get("previewListResource").toString()); |
| | | return toAjax(iSysConfigService.updateConfig(config)); |
| | | } |