@Component public class SohelpDynamicDatasource extends Object
构造器和说明 |
---|
SohelpDynamicDatasource() |
限定符和类型 | 方法和说明 |
---|---|
void |
delete(String keyName)
关闭数据源
|
boolean |
exist(String key)
根据数据源名称判断数据源是否存在
|
String |
getDatabaseName()
获取默认数据库名字
|
String |
getDatabaseName(String key) |
String |
getDatabaseType()
获取默认数据源类型
|
String |
getDatabaseType(String key)
根据数据源获取数据库类型
|
DataSource |
getDatasource(String key)
根据数据源Key获取数据源
|
org.springframework.jdbc.core.JdbcTemplate |
getJdbcTemplate(String key)
根据数据源获取JdbcTemplate接口
|
org.mybatis.spring.SqlSessionTemplate |
getSessionTemplate(String key)
根据数据源K获取SqlSessionTemplate接口
|
org.apache.ibatis.session.SqlSessionFactory |
getSqlSessionFactory(DataSource datasource)
根据Datasource初始化SqlSessionFactory
|
Map<String,String> |
getTableComment(String key)
根据数据源获取表备注说明
|
Map<String,Map<String,Map<String,Object>>> |
getTableField(String key)
获取表字段信息
|
Map<String,Map<String,Object>> |
getTableField(String key,
String tableName)
获取表结构信息
|
String |
getTypeByDbName(String dbName)
根据数据库名字获取数据库类型
|
List<String> |
list()
获取已启动数据源列表
|
void |
refresh()
初始化数据源
|
void |
reloadTable(String datasource,
String tableName) |
void |
removeTableCache(String key)
根据数据源删除表缓存
|
void |
start(String key)
启动数据源
|
public void removeTableCache(String key) throws SQLException
key
- SQLException
public boolean exist(String key)
key
- 数据源Keypublic String getDatabaseName(String key) throws SQLException
key
- 数据源KeySQLException
public Map<String,String> getTableComment(String key) throws SQLException
key
- 数据源SQLException
public Map<String,Map<String,Object>> getTableField(String key, String tableName) throws SQLException
key
- 数据源tableName
- 表名SQLException
public Map<String,Map<String,Map<String,Object>>> getTableField(String key) throws SQLException
key
- 数据源SQLException
public String getDatabaseType(String key) throws SQLException
key
- 数据源KeySQLException
public String getTypeByDbName(String dbName) throws SQLException
dbName
- 数据库名称SQLException
public DataSource getDatasource(String key)
key
- 数据源Keypublic String getDatabaseName() throws SQLException
SQLException
public String getDatabaseType() throws SQLException
SQLException
public org.springframework.jdbc.core.JdbcTemplate getJdbcTemplate(String key)
key
- 数据源Keypublic org.apache.ibatis.session.SqlSessionFactory getSqlSessionFactory(DataSource datasource) throws SQLException
datasource
- 数据源Exception
SQLException
public org.mybatis.spring.SqlSessionTemplate getSessionTemplate(String key) throws SQLException
key
- 数据源KeyException
SQLException
@PostConstruct public void refresh() throws SQLException
SQLException
public void delete(String keyName)
keyName
- 数据源KeyCopyright © 2025. All rights reserved.