From 657cfcae0e20572ad21f0f23ba341110ea1a3013 Mon Sep 17 00:00:00 2001 From: cheney <1251790704@qq.com> Date: Thu, 1 Dec 2022 14:10:25 +0800 Subject: [PATCH] =?UTF-8?q?=E9=99=84=E4=BB=B6=E7=AE=A1=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../iasf/controller/SysContentController.java | 15 +++++++++++++++ .../iasf/controller/SysFilesController.java | 3 +++ .../com/huoran/iasf/entity/SysFilesEntity.java | 8 +++++++- .../com/huoran/iasf/vo/req/FileParameters.java | 3 +++ 4 files changed, 28 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/huoran/iasf/controller/SysContentController.java b/src/main/java/com/huoran/iasf/controller/SysContentController.java index 8088d22..57266f4 100644 --- a/src/main/java/com/huoran/iasf/controller/SysContentController.java +++ b/src/main/java/com/huoran/iasf/controller/SysContentController.java @@ -6,8 +6,10 @@ import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.huoran.iasf.entity.SysColumn; import com.huoran.iasf.entity.SysContentFile; +import com.huoran.iasf.entity.SysFilesEntity; import com.huoran.iasf.service.SysColumnService; import com.huoran.iasf.service.SysContentFileService; +import com.huoran.iasf.service.SysFilesService; import com.huoran.iasf.vo.req.ContentHeavyTitleReqVO; import com.huoran.iasf.vo.req.ContentReq; import com.huoran.iasf.vo.req.PageContentReqVO; @@ -49,6 +51,9 @@ public class SysContentController { @Autowired public SysContentFileService fileService; + @Autowired + public SysFilesService sysFilesService; + @PostMapping("/pagingQuery") @@ -92,6 +97,10 @@ public class SysContentController { @PostMapping("/delete") @ApiOperation(value = "删除", response = SysContent.class) public R delete(@ApiParam(name = "id", value = "主键", required = true) @RequestParam Integer id) { + UpdateWrapper queryWrapper = new UpdateWrapper<>(); + queryWrapper.eq("quote_id",id); + queryWrapper.set("is_del",1); + sysFilesService.update(queryWrapper); boolean delState = service.removeById(id); return delState ? R.success() : R.fail("删除失败"); } @@ -100,6 +109,12 @@ public class SysContentController { @PostMapping("/batchDeletion") @ApiOperation(value = "批量删除文章", response = SysContent.class) public R batchDeletion(@ApiParam(name = "ids", value = "主键", required = true) @RequestParam List ids) { + for (Integer id : ids) { + UpdateWrapper queryWrapper = new UpdateWrapper<>(); + queryWrapper.eq("quote_id",id); + queryWrapper.set("is_del",1); + sysFilesService.update(queryWrapper); + } boolean delState = service.removeByIds(ids); return delState ? R.success() : R.fail("删除失败"); } diff --git a/src/main/java/com/huoran/iasf/controller/SysFilesController.java b/src/main/java/com/huoran/iasf/controller/SysFilesController.java index a7d7f64..412b949 100644 --- a/src/main/java/com/huoran/iasf/controller/SysFilesController.java +++ b/src/main/java/com/huoran/iasf/controller/SysFilesController.java @@ -84,6 +84,7 @@ public class SysFilesController { UpdateWrapper updateWrapper = new UpdateWrapper<>(); updateWrapper.set("quote",fileParameters.getQuote()). set("is_release",fileParameters.getIsRelease()). + set("quote_id",fileParameters.getQuoteId()). eq("id", fileParameters.getId()); return sysFilesService.update(updateWrapper) ? R.success() : R.fail("更新失败"); } @@ -132,6 +133,8 @@ public class SysFilesController { queryWrapper.isNotNull(SysFilesEntity::getQuote); //只查看已发布的文件 queryWrapper.eq(SysFilesEntity::getIsRelease,1); + //查看文章未删除的 + queryWrapper.eq(SysFilesEntity::getIsDel,0); IPage iPage = sysFilesService.page(sysFiles.getQueryPage(),queryWrapper); return R.success(iPage); } diff --git a/src/main/java/com/huoran/iasf/entity/SysFilesEntity.java b/src/main/java/com/huoran/iasf/entity/SysFilesEntity.java index 83c15ca..07e3eeb 100644 --- a/src/main/java/com/huoran/iasf/entity/SysFilesEntity.java +++ b/src/main/java/com/huoran/iasf/entity/SysFilesEntity.java @@ -59,9 +59,15 @@ public class SysFilesEntity extends BaseEntity implements Serializable { private String site; @ApiModelProperty(value = "是否已删除,未删除表示该文件正在使用") - @TableField(fill = FieldFill.INSERT) + @TableLogic private Integer deleted; + @ApiModelProperty(value = "文章是否删除") + private Integer isDel; + + @ApiModelProperty(value = "引用文章id") + private Integer quoteId; + @TableField(value = "create_date", fill = FieldFill.INSERT) @ApiModelProperty(value = "创建时间") private Date createDate; 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 3c95802..253955c 100644 --- a/src/main/java/com/huoran/iasf/vo/req/FileParameters.java +++ b/src/main/java/com/huoran/iasf/vo/req/FileParameters.java @@ -23,6 +23,9 @@ public class FileParameters { @ApiModelProperty(value = "文件id") private String id; + @ApiModelProperty(value = "引用文章id") + private Integer quoteId; + @ApiModelProperty(value = "是否发布(默认0未发布,1已发布)") private Integer isRelease;