From b8695d22811baf27d0637f796658a2402a23ae75 Mon Sep 17 00:00:00 2001 From: "rong.liu" Date: Thu, 6 Apr 2023 18:42:13 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E8=AF=A6=E6=83=85=E5=88=A4?= =?UTF-8?q?=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../huoran/iasf/controller/SysColumnController.java | 4 ++-- .../iasf/controller/SysColumnLongPageController.java | 5 +++++ .../SysContentClassificationController.java | 5 +++++ .../huoran/iasf/controller/SysContentController.java | 11 ++++++----- .../iasf/controller/SysContentLabelController.java | 9 ++++++--- 5 files changed, 24 insertions(+), 10 deletions(-) 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);