|
|
@ -141,7 +141,7 @@ public class SysContentController { |
|
|
|
} |
|
|
|
} |
|
|
|
sysContent.setSequence(count + 1);*/ |
|
|
|
sysContent.setSequence(count + 1);*/ |
|
|
|
boolean addState = service.save(sysContent); |
|
|
|
boolean addState = service.save(sysContent); |
|
|
|
columnService.removeArticles(sysContent.getColumnId()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return addState ? R.success(sysContent.getId()) : R.fail("新增失败"); |
|
|
|
return addState ? R.success(sysContent.getId()) : R.fail("新增失败"); |
|
|
|
} |
|
|
|
} |
|
|
@ -152,7 +152,6 @@ public class SysContentController { |
|
|
|
@ApiOperation(value = "修改", response = SysContent.class) |
|
|
|
@ApiOperation(value = "修改", response = SysContent.class) |
|
|
|
public R update(@RequestBody @ApiParam(name = "文章管理对象", value = "传入json格式", required = true) SysContent sysContent) { |
|
|
|
public R update(@RequestBody @ApiParam(name = "文章管理对象", value = "传入json格式", required = true) SysContent sysContent) { |
|
|
|
boolean updateState = service.updateById(sysContent); |
|
|
|
boolean updateState = service.updateById(sysContent); |
|
|
|
columnService.removeArticles(sysContent.getColumnId()); |
|
|
|
|
|
|
|
return updateState ? R.success() : R.fail("编辑失败"); |
|
|
|
return updateState ? R.success() : R.fail("编辑失败"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -167,8 +166,6 @@ public class SysContentController { |
|
|
|
queryWrapper.eq("quote_type", 0); |
|
|
|
queryWrapper.eq("quote_type", 0); |
|
|
|
queryWrapper.set("is_del", 1); |
|
|
|
queryWrapper.set("is_del", 1); |
|
|
|
sysFilesService.update(queryWrapper); |
|
|
|
sysFilesService.update(queryWrapper); |
|
|
|
SysContent sysContent = service.getById(id); |
|
|
|
|
|
|
|
columnService.removeArticles(sysContent.getColumnId()); |
|
|
|
|
|
|
|
boolean delState = service.removeById(id); |
|
|
|
boolean delState = service.removeById(id); |
|
|
|
return delState ? R.success() : R.fail("删除失败"); |
|
|
|
return delState ? R.success() : R.fail("删除失败"); |
|
|
|
} |
|
|
|
} |
|
|
@ -179,8 +176,6 @@ public class SysContentController { |
|
|
|
@ApiOperation(value = "批量删除文章", response = SysContent.class) |
|
|
|
@ApiOperation(value = "批量删除文章", response = SysContent.class) |
|
|
|
public R batchDeletion(@ApiParam(name = "ids", value = "主键", required = true) @RequestBody List<Integer> ids) { |
|
|
|
public R batchDeletion(@ApiParam(name = "ids", value = "主键", required = true) @RequestBody List<Integer> ids) { |
|
|
|
for (Integer id : ids) { |
|
|
|
for (Integer id : ids) { |
|
|
|
SysContent sysContent = service.getById(id); |
|
|
|
|
|
|
|
columnService.removeArticles(sysContent.getColumnId()); |
|
|
|
|
|
|
|
UpdateWrapper<SysFilesEntity> queryWrapper = new UpdateWrapper<>(); |
|
|
|
UpdateWrapper<SysFilesEntity> queryWrapper = new UpdateWrapper<>(); |
|
|
|
queryWrapper.eq("quote_id", id); |
|
|
|
queryWrapper.eq("quote_id", id); |
|
|
|
queryWrapper.eq("quote_type", 0); |
|
|
|
queryWrapper.eq("quote_type", 0); |
|
|
@ -192,14 +187,14 @@ public class SysContentController { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@PostMapping("/checkIfTheTitleIsRepeat") |
|
|
|
@PostMapping("/checkIfTheTitleIsRepeat") |
|
|
|
// @Decrypt
|
|
|
|
@Decrypt |
|
|
|
@ApiOperation(value = "标题判重——只对已发布的判重(新增,编辑,点击发布时候都要调用判断))", response = ContentHeavyTitleReqVO.class) |
|
|
|
@ApiOperation(value = "标题判重——只对已发布的判重(新增,编辑,点击发布时候都要调用判断))", response = ContentHeavyTitleReqVO.class) |
|
|
|
public R checkIfTheTitleIsRepeat(@RequestBody @Valid ContentHeavyTitleReqVO content) throws UnsupportedEncodingException { |
|
|
|
public R checkIfTheTitleIsRepeat(@RequestBody @Valid ContentHeavyTitleReqVO content) throws UnsupportedEncodingException { |
|
|
|
// if (!org.springframework.util.StringUtils.isEmpty(content.getTitle())) {
|
|
|
|
if (!org.springframework.util.StringUtils.isEmpty(content.getTitle())) { |
|
|
|
// //中文转码
|
|
|
|
//中文转码
|
|
|
|
// String name = URLDecoder.decode(content.getTitle(), StandardCharsets.UTF_8.toString());
|
|
|
|
String name = URLDecoder.decode(content.getTitle(), StandardCharsets.UTF_8.toString()); |
|
|
|
// content.setTitle(name);
|
|
|
|
content.setTitle(name); |
|
|
|
// }
|
|
|
|
} |
|
|
|
return service.checkIfTheTitleIsRepeat(content) ? R.success() : R.fail("该标题已重复!"); |
|
|
|
return service.checkIfTheTitleIsRepeat(content) ? R.success() : R.fail("该标题已重复!"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -304,8 +299,6 @@ public class SysContentController { |
|
|
|
//是否置顶(默认为0 不置顶 1为置顶)
|
|
|
|
//是否置顶(默认为0 不置顶 1为置顶)
|
|
|
|
UpdateWrapper<SysContent> updateWrap = new UpdateWrapper<>(); |
|
|
|
UpdateWrapper<SysContent> updateWrap = new UpdateWrapper<>(); |
|
|
|
|
|
|
|
|
|
|
|
// columnService.removeArticles(columnId);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (articleTopOperation.getIsTop() == 1) { |
|
|
|
if (articleTopOperation.getIsTop() == 1) { |
|
|
|
//置顶时间(置顶一次更新一次)
|
|
|
|
//置顶时间(置顶一次更新一次)
|
|
|
|
updateWrap.set("top_time", new Date()); |
|
|
|
updateWrap.set("top_time", new Date()); |
|
|
|