|
|
|
@ -197,7 +197,7 @@ public class ModelController extends BladeController {
|
|
|
|
|
*/ |
|
|
|
|
private TableInfo getTableInfo(String tableName, Long datasourceId) { |
|
|
|
|
Datasource datasource = datasourceService.getById(datasourceId); |
|
|
|
|
ConfigBuilder config = getConfigBuilder(datasource); |
|
|
|
|
ConfigBuilder config = getConfigBuilder(datasource, tableName); |
|
|
|
|
List<TableInfo> tableInfoList = config.getTableInfoList(); |
|
|
|
|
TableInfo tableInfo = null; |
|
|
|
|
Iterator<TableInfo> iterator = tableInfoList.stream().filter(table -> table.getName().equals(tableName)).collect(Collectors.toList()).iterator(); |
|
|
|
@ -214,8 +214,21 @@ public class ModelController extends BladeController {
|
|
|
|
|
* @param datasource 数据源信息 |
|
|
|
|
*/ |
|
|
|
|
private ConfigBuilder getConfigBuilder(Datasource datasource) { |
|
|
|
|
StrategyConfig strategyConfig = new StrategyConfig.Builder() |
|
|
|
|
.entityBuilder() |
|
|
|
|
return getConfigBuilder(datasource, null); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 获取表配置信息 |
|
|
|
|
* |
|
|
|
|
* @param datasource 数据源信息 |
|
|
|
|
* @param tableName 表名 |
|
|
|
|
*/ |
|
|
|
|
private ConfigBuilder getConfigBuilder(Datasource datasource, String tableName) { |
|
|
|
|
StrategyConfig.Builder builder = new StrategyConfig.Builder(); |
|
|
|
|
if (StringUtil.isNotBlank(tableName)) { |
|
|
|
|
builder.addInclude(tableName); |
|
|
|
|
} |
|
|
|
|
StrategyConfig strategyConfig = builder.entityBuilder() |
|
|
|
|
.naming(NamingStrategy.underline_to_camel) |
|
|
|
|
.columnNaming(NamingStrategy.underline_to_camel).build(); |
|
|
|
|
DataSourceConfig datasourceConfig = new DataSourceConfig.Builder( |
|
|
|
|