当前使用版本(必填,否则不予处理)
3.4.0
该问题是如何引起的?(确定最新版也有问题再提!!!)
您好,是否有想法对达梦数据库实体类注解方式做下兼容呢,通过识别达梦数据源拼装sql时自动加双引号,现在写着感觉有点别扭,不需要在加 \"
//@TableName("user") mysql 表名
@TableName("\"ICEFOX\".\"user\"") 达梦 模式名.表名
public class User {
//@TableId("id") mysql
@TableId("\"id\"") //达梦
private String id;
//@TableField("username")
@TableField("\"username\"")
private String username;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
@Override
public String toString() {
return "User{" +
"id='" + id + '\'' +
", username='" + username + '\'' +
'}';
}
}
重现步骤(如果有就写完整)
报错信息
Comment From: miemieYaho
没有
Comment From: IceFoxs
没有
是加不了吗?
Comment From: qmdx
你可以试下全局配置 schema 及 columnFormat 参数能否满足你的场景
Comment From: IceFoxs
columnFormat 谢谢,你好
@TableName(value = "user", schema = "test") ==> schema.tablename 只是简单的字符串拼接
@TableName(value = "\"user\"", schema = "test.\"%s\"") test."user" ==> ,我希望的写法是这样,貌似好像TableName不支持%s替换
只能写成这样 @TableName(value = "\"user\"", schema = "test") ==> test."user"
@TableName(value = "\"user\"")
//@TableName(value = "user")
mybatis-plus.global-config.db-config.column-format="%s" =>对列有效
mybatis-plus.global-config.db-config.schema=test
如何能在配置中对表名统一加前后双引号,不希望写成这样@TableName(value = "\"user\"")
Comment From: IceFoxs
你可以试下全局配置 schema 及 columnFormat 参数能否满足你的场景
或者是否可以增加对表名的format 类似这样的配置 ,支持对表的format mybatis-plus.global-config.db-config.table-name-format
Comment From: qmdx
你可以试下全局配置 schema 及 columnFormat 参数能否满足你的场景
或者是否可以增加对表名的format 类似这样的配置 ,支持对表的format mybatis-plus.global-config.db-config.table-name-format
建议你查询下达梦能不能不携带 双引号 我猜应该是可以做到的
Comment From: IceFoxs
你可以试下全局配置 schema 及 columnFormat 参数能否满足你的场景
或者是否可以增加对表名的format 类似这样的配置 ,支持对表的format mybatis-plus.global-config.db-config.table-name-format
建议你查询下达梦能不能不携带 双引号 我猜应该是可以做到的
原因找到了换个表名就可以了,是因为user在达梦数据库是关键字,如果使用必须加双引号,但是mysql就没问题;如果就想使用user作为表名,似乎代码就无法统一了;
Comment From: qmdx
你可以试下全局配置 schema 及 columnFormat 参数能否满足你的场景
或者是否可以增加对表名的format 类似这样的配置 ,支持对表的format mybatis-plus.global-config.db-config.table-name-format
建议你查询下达梦能不能不携带 双引号 我猜应该是可以做到的
原因找到了换个表名就可以了,是因为user在达梦数据库是关键字,如果使用必须加双引号,但是mysql就没问题;如果就想使用user作为表名,似乎代码就无法统一了;
你可以带上前缀 sys_user
Comment From: IceFoxs
你可以试下全局配置 schema 及 columnFormat 参数能否满足你的场景
或者是否可以增加对表名的format 类似这样的配置 ,支持对表的format mybatis-plus.global-config.db-config.table-name-format
建议你查询下达梦能不能不携带 双引号 我猜应该是可以做到的
原因找到了换个表名就可以了,是因为user在达梦数据库是关键字,如果使用必须加双引号,但是mysql就没问题;如果就想使用user作为表名,似乎代码就无法统一了;
你可以带上前缀 sys_user
但是如果能做到更灵活的配置,既然考虑到能对column进行fromat,应该也能对表名进行format,这样兼容性会好一点感觉,可以默认不开启。
Comment From: bkingalex
达梦数据库在创建数据库实例的时候 设置大小写不敏感,写sql的时候就不需要对字段名、表名加引号