当前使用版本(必须填写清楚,否则不予处理)
com.baomidou:mybatis-plus:3.3.1
该问题是怎么引起的?(最新版上已修复的会直接close掉)
将实体字段名称修改为数据库关键字,再给字段加上注解@TableField("xxx") 例如:实体中字段名称是desc,注解是@TableField("description")
重现步骤
1.修改实体字段名称为数据库关键字 2.修改注解中的值与数据库字段名称一致
报错信息
2020-03-18 16:53:37.254 DEBUG 15844 --- [nio-8089-exec-1] c.c.d.t.d.m.TestTable.selectPage : ==> Preparing: SELECT id,name,description AS desc,type,expression FROM test_table 2020-03-18 16:53:37.291 DEBUG 15844 --- [nio-8089-exec-1] c.c.d.t.d.m.TestTable.selectPage : ==> Parameters: ... Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: 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 'desc,type,expression FROM test_table' at line 1 ; bad SQL grammar []; nested exception is com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: 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 'desc,type,expression FROM test_table' at line 1 at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:588)
Comment From: miemieYaho
去看文档