附件管理

master
cheney 2 years ago
parent a197613156
commit 657cfcae0e
  1. 15
      src/main/java/com/huoran/iasf/controller/SysContentController.java
  2. 3
      src/main/java/com/huoran/iasf/controller/SysFilesController.java
  3. 8
      src/main/java/com/huoran/iasf/entity/SysFilesEntity.java
  4. 3
      src/main/java/com/huoran/iasf/vo/req/FileParameters.java

@ -6,8 +6,10 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.huoran.iasf.entity.SysColumn; import com.huoran.iasf.entity.SysColumn;
import com.huoran.iasf.entity.SysContentFile; import com.huoran.iasf.entity.SysContentFile;
import com.huoran.iasf.entity.SysFilesEntity;
import com.huoran.iasf.service.SysColumnService; import com.huoran.iasf.service.SysColumnService;
import com.huoran.iasf.service.SysContentFileService; 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.ContentHeavyTitleReqVO;
import com.huoran.iasf.vo.req.ContentReq; import com.huoran.iasf.vo.req.ContentReq;
import com.huoran.iasf.vo.req.PageContentReqVO; import com.huoran.iasf.vo.req.PageContentReqVO;
@ -49,6 +51,9 @@ public class SysContentController {
@Autowired @Autowired
public SysContentFileService fileService; public SysContentFileService fileService;
@Autowired
public SysFilesService sysFilesService;
@PostMapping("/pagingQuery") @PostMapping("/pagingQuery")
@ -92,6 +97,10 @@ public class SysContentController {
@PostMapping("/delete") @PostMapping("/delete")
@ApiOperation(value = "删除", response = SysContent.class) @ApiOperation(value = "删除", response = SysContent.class)
public R delete(@ApiParam(name = "id", value = "主键", required = true) @RequestParam Integer id) { public R delete(@ApiParam(name = "id", value = "主键", required = true) @RequestParam Integer id) {
UpdateWrapper<SysFilesEntity> queryWrapper = new UpdateWrapper<>();
queryWrapper.eq("quote_id",id);
queryWrapper.set("is_del",1);
sysFilesService.update(queryWrapper);
boolean delState = service.removeById(id); boolean delState = service.removeById(id);
return delState ? R.success() : R.fail("删除失败"); return delState ? R.success() : R.fail("删除失败");
} }
@ -100,6 +109,12 @@ public class SysContentController {
@PostMapping("/batchDeletion") @PostMapping("/batchDeletion")
@ApiOperation(value = "批量删除文章", response = SysContent.class) @ApiOperation(value = "批量删除文章", response = SysContent.class)
public R batchDeletion(@ApiParam(name = "ids", value = "主键", required = true) @RequestParam List<Integer> ids) { public R batchDeletion(@ApiParam(name = "ids", value = "主键", required = true) @RequestParam List<Integer> ids) {
for (Integer id : ids) {
UpdateWrapper<SysFilesEntity> queryWrapper = new UpdateWrapper<>();
queryWrapper.eq("quote_id",id);
queryWrapper.set("is_del",1);
sysFilesService.update(queryWrapper);
}
boolean delState = service.removeByIds(ids); boolean delState = service.removeByIds(ids);
return delState ? R.success() : R.fail("删除失败"); return delState ? R.success() : R.fail("删除失败");
} }

@ -84,6 +84,7 @@ public class SysFilesController {
UpdateWrapper<SysFilesEntity> updateWrapper = new UpdateWrapper<>(); UpdateWrapper<SysFilesEntity> updateWrapper = new UpdateWrapper<>();
updateWrapper.set("quote",fileParameters.getQuote()). updateWrapper.set("quote",fileParameters.getQuote()).
set("is_release",fileParameters.getIsRelease()). set("is_release",fileParameters.getIsRelease()).
set("quote_id",fileParameters.getQuoteId()).
eq("id", fileParameters.getId()); eq("id", fileParameters.getId());
return sysFilesService.update(updateWrapper) ? R.success() : R.fail("更新失败"); return sysFilesService.update(updateWrapper) ? R.success() : R.fail("更新失败");
} }
@ -132,6 +133,8 @@ public class SysFilesController {
queryWrapper.isNotNull(SysFilesEntity::getQuote); queryWrapper.isNotNull(SysFilesEntity::getQuote);
//只查看已发布的文件 //只查看已发布的文件
queryWrapper.eq(SysFilesEntity::getIsRelease,1); queryWrapper.eq(SysFilesEntity::getIsRelease,1);
//查看文章未删除的
queryWrapper.eq(SysFilesEntity::getIsDel,0);
IPage<SysFilesEntity> iPage = sysFilesService.page(sysFiles.getQueryPage(),queryWrapper); IPage<SysFilesEntity> iPage = sysFilesService.page(sysFiles.getQueryPage(),queryWrapper);
return R.success(iPage); return R.success(iPage);
} }

@ -59,9 +59,15 @@ public class SysFilesEntity extends BaseEntity implements Serializable {
private String site; private String site;
@ApiModelProperty(value = "是否已删除,未删除表示该文件正在使用") @ApiModelProperty(value = "是否已删除,未删除表示该文件正在使用")
@TableField(fill = FieldFill.INSERT) @TableLogic
private Integer deleted; private Integer deleted;
@ApiModelProperty(value = "文章是否删除")
private Integer isDel;
@ApiModelProperty(value = "引用文章id")
private Integer quoteId;
@TableField(value = "create_date", fill = FieldFill.INSERT) @TableField(value = "create_date", fill = FieldFill.INSERT)
@ApiModelProperty(value = "创建时间") @ApiModelProperty(value = "创建时间")
private Date createDate; private Date createDate;

@ -23,6 +23,9 @@ public class FileParameters {
@ApiModelProperty(value = "文件id") @ApiModelProperty(value = "文件id")
private String id; private String id;
@ApiModelProperty(value = "引用文章id")
private Integer quoteId;
@ApiModelProperty(value = "是否发布(默认0未发布,1已发布)") @ApiModelProperty(value = "是否发布(默认0未发布,1已发布)")
private Integer isRelease; private Integer isRelease;

Loading…
Cancel
Save