mybatis-plus3 You have an error in your SQL syntax; check the manual that corresponds to your MySQL

一,错误描述

    使用mybatis-plus3  新增,调用save方法新增报错。怎么看都没有问题,按理说不会出现问题,sql打印出来感觉语法也没问题,一时就懵逼了。最后还是使用老办法,把对应的数据库SQL放到数据库中执行查看,果然。。。。。

 

 INSERT INTO operationlog  ( operationuser,  interfacename, describe, reqparam, respparam,  opermodul, opertype )  VALUES  ( ?,  ?, ?, ?, ?,  ?, ? )

使用了关键字  describe,记录下吧  。知道哪出现问题了,直接把字段换一下,解决

describe   -- operdescribe

此类问题一般是数据库语法错误,不要相信自己的感觉,建议朋友们把SQL放在数据库中试一下

 

二,控制台报错

org.springframework.jdbc.BadSqlGrammarException: 
### 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 'describe,
reqparam,
respparam,

opermodul,
opertype )  VALUES  ( '1',

'com.sgfd' at line 4
### The error may exist in com/sgfd/mapper/OperationlogMapper.java (best guess)
### The error may involve com.sgfd.mapper.OperationlogMapper.insert-Inline
### The error occurred while setting parameters
### SQL: INSERT INTO operationlog  ( operationuser,  interfacename, describe, reqparam, respparam,  opermodul, opertype )  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 'describe,
reqparam,
respparam,

opermodul,
opertype )  VALUES  ( '1',

'com.sgfd' at line 4
; 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 'describe,
reqparam,
respparam,

opermodul,
opertype )  VALUES  ( '1',

'com.sgfd' at line 4
	at 。。。。。。

 

你可能感兴趣的:(java,mybatis,#,mysql,mybatis-plus)