From 7d67417752df8a7ec72fa31c098ee40e6557a784 Mon Sep 17 00:00:00 2001 From: YunaiV <> Date: Thu, 28 Feb 2019 23:20:11 +0800 Subject: [PATCH] =?UTF-8?q?1.=20=E8=B5=84=E6=BA=90=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E5=AE=8C=E6=88=90=202.=20=E4=BF=AE=E5=A4=8D=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E5=BA=93=E8=BF=9E=E6=8E=A5=E6=9C=AA=E8=AE=BE=E7=BD=AE=20UTF-8?= =?UTF-8?q?=203.=20=E5=85=A8=E5=B1=80=E5=BC=82=E5=B8=B8=E6=8B=A6=E6=88=AA?= =?UTF-8?q?=E5=99=A8=EF=BC=8C=E6=98=BE=E7=A4=BA=E5=85=B7=E4=BD=93=E7=9A=84?= =?UTF-8?q?=E5=8F=82=E6=95=B0=E7=BC=BA=E5=A4=B1~?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cn/iocoder/mall/admin/service/ResourceServiceImpl.java | 2 +- .../src/main/resources/config/application.yaml | 2 +- .../common/framework/config/GlobalExceptionHandler.java | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/admin/admin-service-impl/src/main/java/cn/iocoder/mall/admin/service/ResourceServiceImpl.java b/admin/admin-service-impl/src/main/java/cn/iocoder/mall/admin/service/ResourceServiceImpl.java index 466f58bce..733479862 100644 --- a/admin/admin-service-impl/src/main/java/cn/iocoder/mall/admin/service/ResourceServiceImpl.java +++ b/admin/admin-service-impl/src/main/java/cn/iocoder/mall/admin/service/ResourceServiceImpl.java @@ -85,7 +85,7 @@ public class ResourceServiceImpl implements ResourceService { } // 校验资源唯一性 ResourceDO existNameResource = resourceMapper.selectByName(resourceUpdateDTO.getName()); - if (existNameResource != null && existNameResource.getId().equals(resourceUpdateDTO.getId())) { + if (existNameResource != null && !existNameResource.getId().equals(resourceUpdateDTO.getId())) { return ServiceExceptionUtil.error(AdminErrorCodeEnum.RESOURCE_NAME_DUPLICATE.getCode()); } // 不能设置自己为父资源 diff --git a/admin/admin-service-impl/src/main/resources/config/application.yaml b/admin/admin-service-impl/src/main/resources/config/application.yaml index d6184dea6..6aa6f2f99 100644 --- a/admin/admin-service-impl/src/main/resources/config/application.yaml +++ b/admin/admin-service-impl/src/main/resources/config/application.yaml @@ -1,7 +1,7 @@ spring: # datasource datasource: - url: jdbc:mysql://180.167.213.26:13306/mall_admin?useSSL=false + url: jdbc:mysql://180.167.213.26:13306/mall_admin?useSSL=false&useUnicode=true&characterEncoding=UTF-8 driver-class-name: com.mysql.jdbc.Driver username: root password: ${MALL_MYSQL_PASSWORD} diff --git a/common/common-framework/src/main/java/cn/iocoder/common/framework/config/GlobalExceptionHandler.java b/common/common-framework/src/main/java/cn/iocoder/common/framework/config/GlobalExceptionHandler.java index 5020c32a9..69ab784fd 100644 --- a/common/common-framework/src/main/java/cn/iocoder/common/framework/config/GlobalExceptionHandler.java +++ b/common/common-framework/src/main/java/cn/iocoder/common/framework/config/GlobalExceptionHandler.java @@ -53,12 +53,12 @@ public class GlobalExceptionHandler { @ResponseBody @ExceptionHandler(value = Exception.class) public CommonResult resultExceptionHandler(HttpServletRequest req, Exception e) { - // TODO 异常日志 - e.printStackTrace(); // TODO 翻译不同的异常 if (e instanceof MissingServletRequestParameterException) { - return CommonResult.error(SysErrorCodeEnum.MISSING_REQUEST_PARAM_ERROR.getCode(), SysErrorCodeEnum.MISSING_REQUEST_PARAM_ERROR.getMessage()); + return CommonResult.error(SysErrorCodeEnum.MISSING_REQUEST_PARAM_ERROR.getCode(), SysErrorCodeEnum.MISSING_REQUEST_PARAM_ERROR.getMessage() + ":" + e.getMessage()); } + // TODO 异常日志 + e.printStackTrace(); // 返回 return CommonResult.error(SysErrorCodeEnum.SYS_ERROR.getCode(), SysErrorCodeEnum.SYS_ERROR.getMessage()); }