mysql 关键字 做字段_mysql数据库如果有关键字作为字段,出现该问题

### 当前使用版本(必须填写清楚,否则不予处理)

```xml

com.baomidou

mybatis-plus

2.2.0

```

### 该问题是怎么引起的?**([最新版](https://search.maven.org/search?q=mybatis-plus)上已修复的会直接**close**掉)**

数据库的字段以关键字作为字段,在mysql中,例如key code 等关键字,2.2.0应该不会出现这种问题的呀

### 重现步骤

![输入图片说明](https://images.gitee.com/uploads/images/2018/1210/092937_9edee05b_128710.png "屏幕截图.png")

### 报错信息

``` sql

org.springframework.jdbc.BadSqlGrammarException:

### Error querying database. Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: 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 'key AS `key`,code,`name`,age,sex,birthday,email,telephone,m_telephone AS mTeleph' at line 1

### The error may exist in cn/licoy/wdog/core/mapper/system/SysUserMapper.java (best guess)

### The error may involve defaultParameterMap

### The error occurred while setting parameters

### SQL: SELECT key AS `key`,code,`name`,age,sex,birthday,email,telephone,m_telephone AS mTelephone,address,`status`,is_manager AS isManager,`password`,position_id AS positionId,rank_id AS rankId,grade_id AS gradeId,job_id AS jobId,department_id AS departmentId,company,emp_status AS empStatus,custom_yh_id AS customYhId,custom_yh_station_id AS customYhStationId,custom_nc_id AS customNcId,custom_nc_station_id AS customNcStationId,ding_user_id AS dingUserId,role_key AS roleKey,created,creater,modified,modifier,remover,removed FROM tb_user WHERE (code = ?)

### Cause: **com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: 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 'key AS `key`,code,`name`,age,sex,birthday,email,telephone,m_telephone AS mTeleph' at line 1**

; bad SQL grammar []; nested exception is com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: 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 'key AS `key`,code,`name`,age,sex,birthday,email,telephone,m_telephone AS mTeleph' at line 1

```

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值