Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
legobackend
/
lego-manage
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
4ef82288
authored
2025-04-23 20:05:34 +0800
by
chentao
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
no message
1 parent
6c69bede
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2 additions
and
11 deletions
lego-core/src/main/java/com/lego/core/annotation/AtLeastOneNonNull.java
lego-framework/src/main/java/com/lego/framework/exception/GlobalExceptionHandler.java
lego-core/src/main/java/com/lego/core/annotation/AtLeastOneNonNull.java
View file @
4ef8228
...
...
@@ -5,8 +5,6 @@ package com.lego.core.annotation;
* @date 2025/4/23
*/
import
com.lego.core.annotation.AtLeastOneNonNullValidator
;
import
javax.validation.Constraint
;
import
javax.validation.Payload
;
import
java.lang.annotation.ElementType
;
...
...
lego-framework/src/main/java/com/lego/framework/exception/GlobalExceptionHandler.java
View file @
4ef8228
...
...
@@ -25,7 +25,6 @@ import org.springframework.web.method.annotation.MethodArgumentTypeMismatchExcep
import
javax.servlet.http.HttpServletRequest
;
import
javax.validation.ConstraintViolation
;
import
javax.validation.ConstraintViolationException
;
import
java.util.Objects
;
/**
* 全局异常处理器
...
...
@@ -187,14 +186,8 @@ public class GlobalExceptionHandler {
@ExceptionHandler
(
MethodArgumentNotValidException
.
class
)
public
R
<
Void
>
handleMethodArgumentNotValidException
(
MethodArgumentNotValidException
e
)
{
log
.
error
(
e
.
getMessage
());
if
(
Objects
.
nonNull
(
e
.
getBindingResult
().
getFieldError
()))
{
String
message
=
e
.
getBindingResult
().
getFieldError
().
getDefaultMessage
();
return
R
.
fail
(
message
);
}
else
{
String
message
=
"2D和3D不能都为空"
;
return
R
.
fail
(
message
);
}
String
message
=
e
.
getBindingResult
().
getFieldError
().
getDefaultMessage
();
return
R
.
fail
(
message
);
}
/**
...
...
Write
Preview
Styling with
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment