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()); }