Skip to content

达梦关键字报错的解决方案

qin kai edited this page Apr 12, 2023 · 1 revision

达梦数据库的关键字和mysql不一样,达梦数据库的关键字有desc,type

对于达梦关键字的处理,DQL语句需要双引号包裹起来关键字,并且需要转为大写(mysql只需要用``包裹即可)

例如: select id,,"DESC","TYPE,update_by,update_time from tb_dwfx_aa

1.对entity层做处理

需要在业务侧加上@TableField(value = "desc"),desc为对应的关键字

@ApiModelProperty(name = "维度描述", notes = "")
@TableField("`desc`")
private String desc;

2.引入依赖

<dependency>
    <groupId>com.iflytek</groupId>
    <artifactId>iflytek-dm-spring-boot-starter</artifactId>
    <version>1.1.1-SNAPSHOT</version>
</dependency>
Clone this wiki locally