1. 资源更新完成

2. 修复数据库连接未设置 UTF-8
3. 全局异常拦截器,显示具体的参数缺失~
This commit is contained in:
YunaiV 2019-02-28 23:20:11 +08:00
parent b1248d7e2a
commit 7d67417752
3 changed files with 5 additions and 5 deletions

View File

@ -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());
}
// 不能设置自己为父资源

View File

@ -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}

View File

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