diff --git a/src/main/java/com/huoran/iasf/controller/SysColumnController.java b/src/main/java/com/huoran/iasf/controller/SysColumnController.java index dcbe8d6..2770b5c 100644 --- a/src/main/java/com/huoran/iasf/controller/SysColumnController.java +++ b/src/main/java/com/huoran/iasf/controller/SysColumnController.java @@ -81,9 +81,9 @@ public class SysColumnController { @ApiOperation(value = "查询详情", response = SysColumn.class) public R findById(@RequestParam("id") @ApiParam(value = "序号") Integer id) { SysColumn sysColumn = service.getById(id); - /*if (sysColumn == null) { + if (sysColumn == null) { throw new NotFoundException(BaseResponseCode.DATA_DOES_NOT_EXIST); - }*/ + } SysTemplateStyle sysTemplateStyle = styleService.getById(sysColumn.getListStyleId()); if (sysTemplateStyle.getPath() != null) { diff --git a/src/main/java/com/huoran/iasf/controller/SysColumnLongPageController.java b/src/main/java/com/huoran/iasf/controller/SysColumnLongPageController.java index ad619ed..5a58038 100644 --- a/src/main/java/com/huoran/iasf/controller/SysColumnLongPageController.java +++ b/src/main/java/com/huoran/iasf/controller/SysColumnLongPageController.java @@ -2,6 +2,8 @@ package com.huoran.iasf.controller; import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.huoran.iasf.common.exception.NotFoundException; +import com.huoran.iasf.common.exception.code.BaseResponseCode; import com.huoran.iasf.common.utils.Constant; import com.huoran.iasf.entity.SysColumn; import com.huoran.iasf.service.SysColumnService; @@ -51,6 +53,9 @@ public class SysColumnLongPageController { @ApiOperation(value = "查询详情", response = SysColumnLongPage.class) public R findById(@ApiParam(name = "id", value = "主键", required = true) @RequestParam Integer id) { SysColumnLongPage sysColumnLongPage = service.getById(id); + if (sysColumnLongPage == null) { + throw new NotFoundException(BaseResponseCode.DATA_DOES_NOT_EXIST); + } return R.success(sysColumnLongPage); } diff --git a/src/main/java/com/huoran/iasf/controller/SysContentClassificationController.java b/src/main/java/com/huoran/iasf/controller/SysContentClassificationController.java index c7c5190..951947c 100644 --- a/src/main/java/com/huoran/iasf/controller/SysContentClassificationController.java +++ b/src/main/java/com/huoran/iasf/controller/SysContentClassificationController.java @@ -1,6 +1,8 @@ package com.huoran.iasf.controller; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.huoran.iasf.common.exception.NotFoundException; +import com.huoran.iasf.common.exception.code.BaseResponseCode; import com.huoran.iasf.common.utils.R; import com.huoran.iasf.entity.SysContentClassification; import com.huoran.iasf.service.SysContentClassificationService; @@ -50,6 +52,9 @@ public class SysContentClassificationController { @ApiOperation(value = "查询详情", response = SysContentClassification.class) public R findById(@ApiParam(name = "id", value = "主键", required = true) @RequestParam Integer id) { SysContentClassification sysContentClassification = service.getById(id); + if (sysContentClassification == null) { + throw new NotFoundException(BaseResponseCode.DATA_DOES_NOT_EXIST); + } return R.success(sysContentClassification); } diff --git a/src/main/java/com/huoran/iasf/controller/SysContentController.java b/src/main/java/com/huoran/iasf/controller/SysContentController.java index 372920d..5bb7b08 100644 --- a/src/main/java/com/huoran/iasf/controller/SysContentController.java +++ b/src/main/java/com/huoran/iasf/controller/SysContentController.java @@ -75,11 +75,14 @@ public class SysContentController { SysContent sysContent = service.getById(id); - /* if (sysContent == null) { + if (sysContent == null) { throw new NotFoundException(BaseResponseCode.DATA_DOES_NOT_EXIST); - }*/ + } SysColumn sysColumn = columnService.getById(sysContent.getColumnId()); + if (sysColumn == null) { + throw new NotFoundException(BaseResponseCode.DATA_DOES_NOT_EXIST); + } /*if (sysColumn == null) { throw new NotFoundException(BaseResponseCode.DATA_DOES_NOT_EXIST); }*/ @@ -220,9 +223,7 @@ public class SysContentController { @PostMapping("/articleTopOperation") @ApiOperation(value = "文章置顶/取消置顶", response = SysContent.class) - public R articleTopOperation( - @ApiParam(name = "isTop", value = "是否置顶(默认为0 不置顶 1为置顶)", required = true) @RequestParam Integer isTop, - @ApiParam(name = "articleId", value = "文章Id", required = true) @RequestParam Integer articleId) { + public R articleTopOperation(@ApiParam(name = "isTop", value = "是否置顶(默认为0 不置顶 1为置顶)", required = true) @RequestParam Integer isTop, @ApiParam(name = "articleId", value = "文章Id", required = true) @RequestParam Integer articleId) { //是否置顶(默认为0 不置顶 1为置顶) UpdateWrapper updateWrap = new UpdateWrapper<>(); diff --git a/src/main/java/com/huoran/iasf/controller/SysContentLabelController.java b/src/main/java/com/huoran/iasf/controller/SysContentLabelController.java index d344ad1..5634d13 100644 --- a/src/main/java/com/huoran/iasf/controller/SysContentLabelController.java +++ b/src/main/java/com/huoran/iasf/controller/SysContentLabelController.java @@ -1,6 +1,8 @@ package com.huoran.iasf.controller; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.huoran.iasf.common.exception.NotFoundException; +import com.huoran.iasf.common.exception.code.BaseResponseCode; import com.huoran.iasf.common.utils.R; import com.huoran.iasf.entity.SysContentClassification; import com.huoran.iasf.entity.SysContentLabel; @@ -46,6 +48,9 @@ public class SysContentLabelController { @ApiOperation(value = "查询详情", response = SysContentLabel.class) public R findById(@ApiParam(name = "id", value = "主键", required = true) @RequestParam Integer id) { SysContentLabel sysContentLabel = service.getById(id); + if (sysContentLabel == null) { + throw new NotFoundException(BaseResponseCode.DATA_DOES_NOT_EXIST); + } return R.success(sysContentLabel); } @@ -60,9 +65,7 @@ public class SysContentLabelController { @PostMapping("/checkForHeavy") @ApiOperation(value = "标签校验判重", response = SysContentLabel.class) - public R checkForHeavy(@ApiParam(name = "siteId", value = "站点id", required = true) @RequestParam Integer siteId, - @ApiParam(name = "labelName", value = "标签名称", required = true) @RequestParam String labelName, - @ApiParam(name = "labelId", value = "标签id(新增不传,编辑传)", required = false) @RequestParam Integer labelId) { + public R checkForHeavy(@ApiParam(name = "siteId", value = "站点id", required = true) @RequestParam Integer siteId, @ApiParam(name = "labelName", value = "标签名称", required = true) @RequestParam String labelName, @ApiParam(name = "labelId", value = "标签id(新增不传,编辑传)", required = false) @RequestParam Integer labelId) { QueryWrapper queryWrapper = new QueryWrapper().eq("site_id", siteId).eq("label_name", labelName);