更新文件相关信息

master
chen 2 years ago
parent abb95641d2
commit 381019bc05
  1. 15
      src/main/java/com/huoran/iasf/controller/SysFilesController.java
  2. 3
      src/main/java/com/huoran/iasf/vo/req/FileParameters.java

@ -2,6 +2,7 @@ package com.huoran.iasf.controller;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; 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.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.huoran.iasf.common.utils.R; import com.huoran.iasf.common.utils.R;
@ -50,7 +51,6 @@ public class SysFilesController {
return result.toJSONString(); return result.toJSONString();
} }
@ApiOperation(value = "新增") @ApiOperation(value = "新增")
@PostMapping("/upload") @PostMapping("/upload")
// @RequiresPermissions(value = {"sysFiles:add", "sysContent:update", "sysContent:add"}, logical = Logical.OR) // @RequiresPermissions(value = {"sysFiles:add", "sysContent:update", "sysContent:add"}, logical = Logical.OR)
@ -66,6 +66,19 @@ public class SysFilesController {
return sysFilesService.saveFile(file,fileParameters); return sysFilesService.saveFile(file,fileParameters);
} }
@ApiOperation(value = "更新文件信息")
@PostMapping("/update")
public R update(FileParameters fileParameters) {
if (fileParameters.getId()==null){
return R.fail("id不能为空");
}
UpdateWrapper<SysFilesEntity> 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 = "文件预览") @ApiOperation(value = "文件预览")
@GetMapping("/preview/{id}") @GetMapping("/preview/{id}")
public void preview(@PathVariable String id, HttpServletRequest req, HttpServletResponse res) { public void preview(@PathVariable String id, HttpServletRequest req, HttpServletResponse res) {

@ -20,4 +20,7 @@ public class FileParameters {
@ApiModelProperty(value = "引用地方",example = "某某文章") @ApiModelProperty(value = "引用地方",example = "某某文章")
private String quote; private String quote;
@ApiModelProperty(value = "文件id")
private String id;
} }

Loading…
Cancel
Save