2020-11-01

项目场景: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键上面的那个符号

 

======>

问题解决.

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 7
    评论
评论 7
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值