diff --git a/src/main/java/com/huoran/iasf/common/exception/handler/RestExceptionHandler.java b/src/main/java/com/huoran/iasf/common/exception/handler/RestExceptionHandler.java index 1228728..d2eebb7 100644 --- a/src/main/java/com/huoran/iasf/common/exception/handler/RestExceptionHandler.java +++ b/src/main/java/com/huoran/iasf/common/exception/handler/RestExceptionHandler.java @@ -17,6 +17,7 @@ import org.springframework.web.bind.annotation.RestControllerAdvice; import javax.validation.ConstraintViolation; import javax.validation.ConstraintViolationException; +import javax.validation.ValidationException; import java.util.HashMap; import java.util.Set; import java.util.concurrent.atomic.AtomicReference; @@ -113,4 +114,11 @@ public class RestExceptionHandler { return R.getResult(BaseResponseCode.METHOD_ARGUMENT_NOT_VALID_EXCEPTION.getCode(), builder.toString()); } + @ExceptionHandler + @ResponseStatus(HttpStatus.NOT_FOUND) + public R handle(ValidationException e) { + log.error("Exception,exception:{}", e, e); + return new R(404, e.getMessage()); + } + } diff --git a/src/main/java/com/huoran/iasf/service/impl/SysColumnServiceImpl.java b/src/main/java/com/huoran/iasf/service/impl/SysColumnServiceImpl.java index 5fc460a..a3bda4f 100644 --- a/src/main/java/com/huoran/iasf/service/impl/SysColumnServiceImpl.java +++ b/src/main/java/com/huoran/iasf/service/impl/SysColumnServiceImpl.java @@ -92,7 +92,7 @@ public class SysColumnServiceImpl extends ServiceImpl listWithTreeMenuVisible(PaginationColumnReqVO column) { - if (column.getRole()!=null&&column.getRole().equals("admin") || ObjectUtil.isNotNull(column.isIsadmin()) && column.isIsadmin()){ + if (column.getRole()!=null||column.getRole().equals("admin") || ObjectUtil.isNotNull(column.isIsadmin()) || column.isIsadmin()){ throw new IllegalArgumentException("参数名不能包含admin"); } //查询所有栏目 diff --git a/src/main/java/com/huoran/iasf/service/impl/SysContentServiceImpl.java b/src/main/java/com/huoran/iasf/service/impl/SysContentServiceImpl.java index ef5b05d..d1084c6 100644 --- a/src/main/java/com/huoran/iasf/service/impl/SysContentServiceImpl.java +++ b/src/main/java/com/huoran/iasf/service/impl/SysContentServiceImpl.java @@ -75,7 +75,7 @@ public class SysContentServiceImpl extends ServiceImpl page = new Page(reqVO.getPageNum(), reqVO.getPageSize());