当前使用版本(必填,否则不予处理)
MP 3.4.2 spring-boot 2.4.5 idea 2020
该问题是如何引起的?(确定最新版也有问题再提!!!)
application.properties中 使用了 spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver 而不是 spring.datasource.driver=com.mysql.cj.jdbc.Driver 导致mp自带的语句在条件构造器前会多一个分号
重现步骤(如果有就写完整)
报错信息
2021-05-21 11:21:47.491 WARN 4684 --- [nio-8090-exec-7] .m.m.a.ExceptionHandlerExceptionResolver : Resolved [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 'AND (id = 1)' at line 1
The error may exist in com/xiangmu/mapper/CustomerMapper.java (best guess)
The error may involve defaultParameterMap
The error occurred while setting parameters
SQL: SELECT * FROM customer WHERE is_deleted=0 ; AND (id = ?)
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 'AND (id = 1)' at line 1
; bad SQL grammar []; nested exception is 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 'AND (id = 1)' at line 1]