diff --git a/src/main/java/com/huoran/iasf/controller/SysFilesController.java b/src/main/java/com/huoran/iasf/controller/SysFilesController.java index e7d58d5..d46db28 100644 --- a/src/main/java/com/huoran/iasf/controller/SysFilesController.java +++ b/src/main/java/com/huoran/iasf/controller/SysFilesController.java @@ -2,6 +2,7 @@ package com.huoran.iasf.controller; import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.huoran.iasf.common.utils.R; @@ -50,7 +51,6 @@ public class SysFilesController { return result.toJSONString(); } - @ApiOperation(value = "新增") @PostMapping("/upload") // @RequiresPermissions(value = {"sysFiles:add", "sysContent:update", "sysContent:add"}, logical = Logical.OR) @@ -66,6 +66,19 @@ public class SysFilesController { return sysFilesService.saveFile(file,fileParameters); } + @ApiOperation(value = "更新文件信息") + @PostMapping("/update") + public R update(FileParameters fileParameters) { + if (fileParameters.getId()==null){ + return R.fail("id不能为空"); + } + UpdateWrapper updateWrapper = new UpdateWrapper<>(); + updateWrapper.set("quote",fileParameters.getQuote()). + eq("site",fileParameters.getSite()). + eq("id", fileParameters.getId()); + return sysFilesService.update(updateWrapper) ? R.success() : R.fail("更新失败"); + } + @ApiOperation(value = "文件预览") @GetMapping("/preview/{id}") public void preview(@PathVariable String id, HttpServletRequest req, HttpServletResponse res) { diff --git a/src/main/java/com/huoran/iasf/vo/req/FileParameters.java b/src/main/java/com/huoran/iasf/vo/req/FileParameters.java index 76725b4..6abb05f 100644 --- a/src/main/java/com/huoran/iasf/vo/req/FileParameters.java +++ b/src/main/java/com/huoran/iasf/vo/req/FileParameters.java @@ -20,4 +20,7 @@ public class FileParameters { @ApiModelProperty(value = "引用地方",example = "某某文章") private String quote; + @ApiModelProperty(value = "文件id") + private String id; + }