Commit abaa9ea87c79fc67e51f743345332b6ae03281c7
1 parent
48cf30aa
Exists in
master
and in
2 other branches
fix a bug about dbname
Showing
2 changed files
with
7 additions
and
5 deletions
Show diff stats
build.gradle
src/main/java/com/taover/repository/CustomJdbcTemplate.java
... | ... | @@ -54,10 +54,12 @@ public class CustomJdbcTemplate<T, ID extends Serializable> { |
54 | 54 | throw new Exception("DAO层初始化失败,失败原因:"+tClassInfo.getName()+"实体类,没有@Table注解指定表名"); |
55 | 55 | } |
56 | 56 | this.tableName = annoTable.name(); |
57 | - if(annoTable.schema() != null){ | |
58 | - this.dbName = annoTable.schema(); | |
59 | - }else if(annoTable.catalog() != null){ | |
60 | - this.dbName = annoTable.catalog(); | |
57 | + String schema = annoTable.schema(); | |
58 | + String catalog = annoTable.catalog(); | |
59 | + if(schema != null && !"".equals(schema)){ | |
60 | + this.dbName = schema; | |
61 | + }else if(catalog != null && !"".equals(catalog)){ | |
62 | + this.dbName = catalog; | |
61 | 63 | } |
62 | 64 | |
63 | 65 | //初始化数据 | ... | ... |