ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds

ERROR 1064 (42000): 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 xxx

錯誤原因爲使用了mysql關鍵字
在sql語句中使用``將表名列名引起來
如:select `desc` from `key` t1 where t1.`id` = 1

當使用了mybatis-plus時,使用了關鍵字作爲表的列名,注意在實體類中加上@TableField註解並指定對應列名

@TableField(value="desc")
private String desc;
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章