chore: 清理冗余注释,保留字段/业务含义注释

This commit is contained in:
2026-05-27 23:03:43 +08:00
parent 78a24e8394
commit a92465dfc0
18 changed files with 225 additions and 88 deletions
@@ -15,41 +15,33 @@ import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;
/**
* @author guo
*/
@RestControllerAdvice
@Slf4j
public class GlobalExceptionHandler {
@ExceptionHandler({ErrorParameterException.class})
public CommonResult errorParameterException(ErrorParameterException ex) {
//code:400
return CommonResult.error(ex.getMessage());
}
@ExceptionHandler({NotFindEntitiesException.class})
public CommonResult notFindEntitiesException(NotFindEntitiesException ex) {
//code:400
return CommonResult.error(ex.getMessage());
}
@ExceptionHandler({AppException.class})
public CommonResult AppException(AppException ex) {
//code:500
return CommonResult.serverError(ex.getMessage());
}
@ExceptionHandler(MethodArgumentNotValidException.class)
public CommonResult MyMethodArgumentNotValidException(MethodArgumentNotValidException ex) {
BindingResult bindingResult = ex.getBindingResult();
//code:400
return CommonResult.error(bindingResult.getFieldError().getDefaultMessage());
}
@ExceptionHandler(NotLoginException.class)
public CommonResult handleNotLogin(NotLoginException e, HttpServletRequest req, HttpServletResponse res) {
//code:401
res.setStatus(HttpStatus.UNAUTHORIZED.value());
return new CommonResult<>(HttpStatus.UNAUTHORIZED.value(), "未登录,请重新登录", null);
}
@@ -57,8 +49,7 @@ public class GlobalExceptionHandler {
@ExceptionHandler(Exception.class)
public CommonResult Exception(Exception ex) {
log.error("系统异常", ex);
//code:400
return CommonResult.error(ex.getMessage());
}
}
}
@@ -4,12 +4,13 @@ import jakarta.validation.groups.Default;
/**
* 全局数据验证分组
* GlobalValidationGroup -> OpenGroups ->ops
* @author guo
*/
public interface Ops {
// 创建组
interface CreateG extends Default {}
interface CreateG extends Default {
}
// 更新组
interface UpdateG {}
interface UpdateG {
}
}