Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
X
xyqb-user2
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
head_group
xyqb-user2
Commits
edd3d915
Commit
edd3d915
authored
Dec 26, 2019
by
杨锐
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
handle BadSqlGrammarException.
parent
33b077e2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
2 deletions
+9
-2
ExceptionHandlingController.java
...antgroup/xyqb/controller/ExceptionHandlingController.java
+9
-2
No files found.
src/main/java/cn/quantgroup/xyqb/controller/ExceptionHandlingController.java
View file @
edd3d915
...
@@ -4,9 +4,8 @@ import cn.quantgroup.xyqb.exception.*;
...
@@ -4,9 +4,8 @@ import cn.quantgroup.xyqb.exception.*;
import
cn.quantgroup.xyqb.model.JsonResult
;
import
cn.quantgroup.xyqb.model.JsonResult
;
import
cn.quantgroup.xyqb.util.IpUtil
;
import
cn.quantgroup.xyqb.util.IpUtil
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.jdbc.BadSqlGrammarException
;
import
org.springframework.validation.BindException
;
import
org.springframework.validation.BindException
;
import
org.springframework.validation.BindingResult
;
import
org.springframework.validation.BindingResult
;
import
org.springframework.validation.ObjectError
;
import
org.springframework.validation.ObjectError
;
...
@@ -158,4 +157,12 @@ public class ExceptionHandlingController implements IBaseController {
...
@@ -158,4 +157,12 @@ public class ExceptionHandlingController implements IBaseController {
public
JsonResult
handleDataException
(
DataException
e
)
{
public
JsonResult
handleDataException
(
DataException
e
)
{
return
JsonResult
.
buildErrorStateResult
(
e
.
getMessage
(),
null
);
return
JsonResult
.
buildErrorStateResult
(
e
.
getMessage
(),
null
);
}
}
@ExceptionHandler
(
BadSqlGrammarException
.
class
)
@ResponseBody
@ResponseStatus
(
HttpStatus
.
OK
)
public
JsonResult
handleBadSqlGrammarException
(
BadSqlGrammarException
e
)
{
log
.
error
(
"sql语法解析异常 error sql = 【{}】"
,
e
.
getSql
(),
e
);
return
JsonResult
.
buildErrorStateResult
(
"sql语法解析异常。"
,
null
);
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
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 comment