前言
使用mybatis-plus操作数据库的时候,调用一个增加方法,结果控制台报了一个sql语句有误。我都没写sql、怎么回事呢? 应该就是数据库的字段问题,去看看数据库中的字段是否含有关键字。我这里的数据库表是使用逆向工程生成的,结果真的是因为关键字问题
1、错误信息
### Error updating database. Cause: 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 '' at line 1
### The error may exist in com/atguigu/gulimall/coupon/dao/SeckillPromotionDao.java (best guess)
### The error may involve com.atguigu.gulimall.coupon.dao.SeckillPromotionDao.insert-Inline
### The error occurred while setting parameters
### SQL: INSERT INTO sms_seckill_promotion VALUES
### Cause: 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 '' at line 1
; bad SQL grammar []; nested exception is 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 '' at line 1] with root cause
2、解决方法
将关键字替换成其它字段