1. 程式人生 > 資料庫 >表字段與mysql關鍵字衝突

表字段與mysql關鍵字衝突

專案啟動提示語法錯誤
[42000][1064] 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 'persist,

檢查發現,表字段中有個persist欄位,和mysql關鍵字衝突
解決該問題,需要在查詢的時候,欄位名帶上反引號,用的是mybatis-plus,所以在對應實體類的欄位加上註解即可

@TableField("`persist`")
private Integer persist;