mirror of
https://gitee.com/mybatis-flex/mybatis-flex.git
synced 2025-12-07 00:58:24 +08:00
fix: 策略中的 schema 和 tableConfig 中的 schema 冲突问题,以 tableConfig 中配置的 schema 为主。
This commit is contained in:
parent
4a604c3bf7
commit
ebfdae3d14
@ -203,14 +203,27 @@ public class Table {
|
|||||||
|
|
||||||
tableAnnotation.append("@Table(value = \"").append(name).append("\"");
|
tableAnnotation.append("@Table(value = \"").append(name).append("\"");
|
||||||
|
|
||||||
if (StringUtil.isNotBlank(schema)) {
|
String globalSchema;
|
||||||
tableAnnotation.append(", schema = \"").append(schema).append("\"");
|
|
||||||
|
if (tableConfig == null) {
|
||||||
|
// 未配置 tableConfig 以策略中的 schema 为主
|
||||||
|
globalSchema = schema;
|
||||||
|
} else if (StringUtil.isBlank(tableConfig.getSchema())) {
|
||||||
|
// 配置 tableConfig 但未指定 schema 还是以策略中的 schema 为主
|
||||||
|
globalSchema = schema;
|
||||||
|
} else {
|
||||||
|
// 以用户设置的 tableConfig 中的 schema 为主
|
||||||
|
globalSchema = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (StringUtil.isNotBlank(globalSchema)) {
|
||||||
|
tableAnnotation.append(", schema = \"").append(globalSchema).append("\"");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tableConfig != null) {
|
if (tableConfig != null) {
|
||||||
// if (tableConfig.getSchema() != null) {
|
if (StringUtil.isNotBlank(tableConfig.getSchema())) {
|
||||||
// tableAnnotation.append(", schema = \"").append(tableConfig.getSchema()).append("\"");
|
tableAnnotation.append(", schema = \"").append(tableConfig.getSchema()).append("\"");
|
||||||
// }
|
}
|
||||||
if (tableConfig.getCamelToUnderline() != null) {
|
if (tableConfig.getCamelToUnderline() != null) {
|
||||||
tableAnnotation.append(", camelToUnderline = \"").append(tableConfig.getCamelToUnderline()).append("\"");
|
tableAnnotation.append(", camelToUnderline = \"").append(tableConfig.getCamelToUnderline()).append("\"");
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user