專案場景:spring-boot整合通用mapper
問題描述:
Caused by: 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 'order ( id,total_num,total_money,pay_money,pay_type,create_time,update_time,use' at line 1
原因分析:
通用mapper直接生成的sql陳述句報語法錯誤
利用mybatis log插件查看sql

將sql陳述句copy到Navicat 中執行
INSERT INTO order ( id,total_num,total_money,pay_money,pay_type,create_time,update_time,username,buyer_rate,source_type,order_status,pay_status,consign_status ) VALUES( '1322732101556027392',4,383600,383600,'1','2020-11-01 10:48:02.842','2020-11-01 10:48:02.842','heima','0','1','0','0','0' );
報同樣錯誤
[Err] 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 'ORDER (
id,
total_num,
total_money,
pay_money,
pay_type,
create_time' at line 1
后來仔細一看,發現表名order是大寫,于是想到order是關鍵字,問題找到了
![]()
解決方案:
將對應物體類上@Table注解里對應的表名改為(name="`order`")即可,注意 ` 是table鍵上面的那個符號

======>![]()
問題解決.
轉載請註明出處,本文鏈接:https://www.uj5u.com/yidong/199572.html
標籤:其他
