From 381019bc0591b410266816885da13a4bfb84bac0 Mon Sep 17 00:00:00 2001 From: chen <1251790704@qq.com> Date: Mon, 29 Aug 2022 11:07:30 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E6=96=87=E4=BB=B6=E7=9B=B8?= =?UTF-8?q?=E5=85=B3=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../iasf/controller/SysFilesController.java | 15 ++++++++++++++- .../com/huoran/iasf/vo/req/FileParameters.java | 3 +++ 2 files changed, 17 insertions(+), 1 deletion(-) 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; + }