@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)
启动数据源
|
@Comment(value="\u6839\u636e\u6570\u636e\u6e90\u5220\u9664\u8868\u7f13\u5b58") public void removeTableCache(String key) throws SQLException
key - SQLException@Comment(value="\u6839\u636e\u6570\u636e\u6e90\u540d\u79f0\u5224\u65ad\u6570\u636e\u6e90\u662f\u5426\u5b58\u5728") public boolean exist(String key)
key - 数据源Key@Comment(value="\u6839\u636e\u6570\u636e\u6e90\u83b7\u53d6\u6570\u636e\u5e93\u540d\u79f0") public String getDatabaseName(String key) throws SQLException
key - 数据源KeySQLException@Comment(value="\u6839\u636e\u6570\u636e\u6e90\u83b7\u53d6\u8868\u5907\u6ce8\u8bf4\u660e") public Map<String,String> getTableComment(String key) throws SQLException
key - 数据源SQLException@Comment(value="\u83b7\u53d6\u8868\u7ed3\u6784\u4fe1\u606f") public Map<String,Map<String,Object>> getTableField(String key, String tableName) throws SQLException
key - 数据源tableName - 表名SQLException@Comment(value="\u83b7\u53d6\u8868\u5b57\u6bb5\u4fe1\u606f") public Map<String,Map<String,Map<String,Object>>> getTableField(String key) throws SQLException
key - 数据源SQLException@Comment(value="\u6839\u636e\u6570\u636e\u6e90\u83b7\u53d6\u6570\u636e\u5e93\u7c7b\u578b") public String getDatabaseType(String key) throws SQLException
key - 数据源KeySQLException@Comment(value="\u6839\u636e\u6570\u636e\u5e93\u540d\u5b57\u83b7\u53d6\u6570\u636e\u5e93\u7c7b\u578b") public String getTypeByDbName(String dbName) throws SQLException
dbName - 数据库名称SQLException@Comment(value="\u6839\u636e\u6570\u636e\u6e90Key\u83b7\u53d6\u6570\u636e\u6e90") public DataSource getDatasource(String key)
key - 数据源Key@Comment(value="\u6839\u636e\u6570\u636e\u6e90\u548c\u8868\u540d\u91cd\u65b0\u52a0\u8f7d\u8868\u7ed3\u6784") public void reloadTable(String datasource, String tableName)
datasource - 数据源tableName - 表名@Comment(value="\u83b7\u53d6\u9ed8\u8ba4\u6570\u636e\u5e93\u540d\u5b57") public String getDatabaseName() throws SQLException
SQLException@Comment(value="\u83b7\u53d6\u9ed8\u8ba4\u6570\u636e\u6e90\u7c7b\u578b") public String getDatabaseType() throws SQLException
SQLException@Comment(value="\u83b7\u53d6\u5df2\u542f\u52a8\u6570\u636e\u6e90\u5217\u8868") public List<String> list()
@Comment(value="\u6839\u636e\u6570\u636e\u6e90\u83b7\u53d6JdbcTemplate\u63a5\u53e3") public org.springframework.jdbc.core.JdbcTemplate getJdbcTemplate(String key)
key - 数据源Key@Comment(value="\u6839\u636eDatasource\u521d\u59cb\u5316SqlSessionFactory") public org.apache.ibatis.session.SqlSessionFactory getSqlSessionFactory(DataSource datasource) throws SQLException
datasource - 数据源ExceptionSQLException@Comment(value="\u6839\u636e\u6570\u636e\u6e90K\u83b7\u53d6SqlSessionTemplate\u63a5\u53e3") public org.mybatis.spring.SqlSessionTemplate getSessionTemplate(String key) throws SQLException
key - 数据源KeyExceptionSQLException@PostConstruct @Comment(value="\u521d\u59cb\u5316\u6570\u636e\u6e90") public void refresh() throws SQLException
SQLException@Comment(value="\u542f\u52a8\u6570\u636e\u6e90") public void start(String key) throws Exception
key - 数据源KeyException@Comment(value="\u5173\u95ed\u6570\u636e\u6e90") public void delete(String keyName)
keyName - 数据源KeyCopyright © 2025. All rights reserved.