@Component public class TableService extends Object
| 构造器和说明 |
|---|
TableService() |
| 限定符和类型 | 方法和说明 |
|---|---|
void |
create(EntityVO entityVO)
创建或更新一个实体结构到数据库中。
|
void |
dropTable(String tableName)
删除默认数据源下指定的表结构。
|
void |
dropTable(String datasourceName,
String tableName)
删除指定数据源下的某个表结构。
|
boolean |
exist(String tableName)
判断某张表是否存在。
|
boolean |
exist(String tableName,
String fieldName)
判断某张表中是否存在指定字段。
|
EntityVO |
get(String tableName)
根据表名获取对应的实体信息(使用默认数据源)。
|
EntityVO |
get(String key,
String tableName)
根据指定的数据源和表名获取对应的实体信息。
|
static TableService |
getInstance()
获取当前Spring容器中TableService实例。
|
List<EntityVO> |
list()
使用默认数据源获取所有表结构信息列表。
|
List<EntityVO> |
list(String key)
获取所有表结构信息列表。
|
public static TableService getInstance()
public EntityVO get(String tableName) throws SQLException
tableName - 数据库表名SQLException - SQL执行异常时抛出public EntityVO get(String key, String tableName) throws SQLException
key - 数据源标识符tableName - 数据库表名SQLException - SQL执行异常时抛出public List<EntityVO> list(String key) throws SQLException
key - 数据源标识符SQLException - SQL执行异常时抛出public List<EntityVO> list() throws SQLException
SQLException - SQL执行异常时抛出public void create(EntityVO entityVO) throws Exception
entityVO - 待创建/更新的实体结构对象Exception - 操作过程中可能发生的异常public void dropTable(String datasourceName, String tableName) throws SQLException, IOException
datasourceName - 数据源名称tableName - 表名SQLException - SQL执行异常时抛出IOException - IO操作异常时抛出public void dropTable(String tableName) throws SQLException, IOException
tableName - 表名SQLException - SQL执行异常时抛出IOException - IO操作异常时抛出public boolean exist(String tableName) throws SQLException
tableName - 表名SQLException - SQL执行异常时抛出public boolean exist(String tableName, String fieldName) throws SQLException
tableName - 表名fieldName - 字段名SQLException - SQL执行异常时抛出Copyright © 2026. All rights reserved.