【异常处理】BadSqlGrammarException低级SQL语法异常

报错

org.springframework.jdbc.BadSqlGrammarException: 
### Error querying database.  Cause: java.sql.SQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'LIMIT 5' at line 3
### The error may exist in top/ambtwill/blog/dao/mapper/ArticleMapper.xml
### The error may involve defaultParameterMap
### The error occurred while setting parameters
### SQL: select * from ms_article          WHERE 1=1          order by weight,create_date desc; LIMIT ?
### Cause: java.sql.SQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'LIMIT 5' at line 3

发现原因

原因就是在Sql语句末尾加上了分号,导致在使用Mybatis-plus时拼接了limit 语句报错

posted @ 2022-03-17 16:20  weiambt  阅读(1077)  评论(0)    收藏  举报