1. 资源更新完成
2. 修复数据库连接未设置 UTF-8 3. 全局异常拦截器,显示具体的参数缺失~
This commit is contained in:
parent
b1248d7e2a
commit
7d67417752
@ -85,7 +85,7 @@ public class ResourceServiceImpl implements ResourceService {
|
|||||||
}
|
}
|
||||||
// 校验资源唯一性
|
// 校验资源唯一性
|
||||||
ResourceDO existNameResource = resourceMapper.selectByName(resourceUpdateDTO.getName());
|
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());
|
return ServiceExceptionUtil.error(AdminErrorCodeEnum.RESOURCE_NAME_DUPLICATE.getCode());
|
||||||
}
|
}
|
||||||
// 不能设置自己为父资源
|
// 不能设置自己为父资源
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
spring:
|
spring:
|
||||||
# datasource
|
# datasource
|
||||||
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
|
driver-class-name: com.mysql.jdbc.Driver
|
||||||
username: root
|
username: root
|
||||||
password: ${MALL_MYSQL_PASSWORD}
|
password: ${MALL_MYSQL_PASSWORD}
|
||||||
|
@ -53,12 +53,12 @@ public class GlobalExceptionHandler {
|
|||||||
@ResponseBody
|
@ResponseBody
|
||||||
@ExceptionHandler(value = Exception.class)
|
@ExceptionHandler(value = Exception.class)
|
||||||
public CommonResult resultExceptionHandler(HttpServletRequest req, Exception e) {
|
public CommonResult resultExceptionHandler(HttpServletRequest req, Exception e) {
|
||||||
// TODO 异常日志
|
|
||||||
e.printStackTrace();
|
|
||||||
// TODO 翻译不同的异常
|
// TODO 翻译不同的异常
|
||||||
if (e instanceof MissingServletRequestParameterException) {
|
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());
|
return CommonResult.error(SysErrorCodeEnum.SYS_ERROR.getCode(), SysErrorCodeEnum.SYS_ERROR.getMessage());
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user