feature: meta field rename
This commit is contained in:
parent
75a5412c2b
commit
643d182d5f
|
@ -10,7 +10,7 @@ import java.util.List;
|
|||
@Builder
|
||||
public class IndexMeta {
|
||||
|
||||
private String indexName;
|
||||
private String name;
|
||||
|
||||
@Builder.Default
|
||||
private List<String> columnNames = Collections.emptyList();
|
||||
|
|
|
@ -10,11 +10,11 @@ import java.util.List;
|
|||
@Builder
|
||||
public class TableMeta {
|
||||
|
||||
private String tableName;
|
||||
private String name;
|
||||
|
||||
private String tableType;
|
||||
private String type;
|
||||
|
||||
private String tableComment;
|
||||
private String comment;
|
||||
|
||||
@Builder.Default
|
||||
private List<ColumnMeta> columns = Collections.emptyList();
|
||||
|
|
|
@ -45,7 +45,7 @@ public class JdbcIndexMetaRepository implements IndexMetaRepository {
|
|||
List<String> columns = new ArrayList<>();
|
||||
columns.add(columnName);
|
||||
IndexMeta indexMeta = IndexMeta.builder()
|
||||
.indexName(indexName)
|
||||
.name(indexName)
|
||||
.columnNames(columns)
|
||||
.isPrimaryKey(Objects.equals("PRIMARY", indexName))
|
||||
.isUniqueKey(Objects.equals(nonUnique, false))
|
||||
|
|
|
@ -50,9 +50,9 @@ public class JdbcTableMetaRepository implements TableMetaRepository {
|
|||
String tableComment = tablesResult.getString("REMARKS");
|
||||
TableCondition tableCondition = TableCondition.of(condition, tableName);
|
||||
TableMeta tableMeta = TableMeta.builder()
|
||||
.tableName(tableName)
|
||||
.tableType(tableType)
|
||||
.tableComment(tableComment)
|
||||
.name(tableName)
|
||||
.type(tableType)
|
||||
.comment(tableComment)
|
||||
.columns(columnMetaRepository.selectColumns(connection, tableCondition))
|
||||
.indexes(indexMetaRepository.selectIndexes(connection, tableCondition))
|
||||
.triggers(triggerMetaRepository.selectTriggers(connection, tableCondition))
|
||||
|
|
|
@ -56,7 +56,7 @@ public class RenderConfig {
|
|||
|
||||
protected LinkedHashMap<String, Function<IndexMeta, String>> indexTitleAndValueMapping() {
|
||||
LinkedHashMap<String, Function<IndexMeta, String>> mapping = new LinkedHashMap<>();
|
||||
mapping.put("Name", IndexMeta::getIndexName);
|
||||
mapping.put("Name", IndexMeta::getName);
|
||||
mapping.put("IsPrimary", index -> index.getIsPrimaryKey() ? "YES" : "");
|
||||
mapping.put("IsUnique", index -> index.getIsUniqueKey() ? "YES" : "");
|
||||
mapping.put("Columns", index -> String.join(", ", index.getColumnNames()));
|
||||
|
|
|
@ -51,10 +51,10 @@ public class MarkdownRender implements Render {
|
|||
|
||||
private void buildTableName(MarkdownBuilder contentBuilder, TableMeta table) {
|
||||
String tableName;
|
||||
if (table.getTableComment() == null || table.getTableComment().trim().isEmpty()) {
|
||||
tableName = table.getTableName();
|
||||
if (table.getComment() == null || table.getComment().trim().isEmpty()) {
|
||||
tableName = table.getName();
|
||||
} else {
|
||||
tableName = table.getTableName() + "(" + table.getTableComment() + ")";
|
||||
tableName = table.getName() + "(" + table.getComment() + ")";
|
||||
}
|
||||
contentBuilder.secondTitle(tableName);
|
||||
}
|
||||
|
|
|
@ -3,21 +3,21 @@
|
|||
| seq | name | comment |
|
||||
| ---- | --------------- | ------ |
|
||||
<#list meta.tables as table>
|
||||
| ${table_index+1} | [${table.tableName}](#${table.tableName}) | ${table.tableComment!'N/A'} |
|
||||
| ${table_index+1} | [${table.name}](#${table.name}) | ${table.comment!'N/A'} |
|
||||
</#list>
|
||||
|
||||
<#if config.renderTables>
|
||||
<#list meta.tables as table>
|
||||
## ${table.tableName}
|
||||
## ${table.name}
|
||||
|
||||
<#if config.renderColumns>
|
||||
### Columns
|
||||
### Columns
|
||||
|
||||
| seq | name | type | nullable | auto increment| default | comment |
|
||||
| ---- | ------ | ------ | ------ | -------- | ------ | ------ |
|
||||
<#list table.columns as column>
|
||||
| ${column_index+1} | ${column.name} | ${column.type} | ${column.isNullable?then('YES','')} | ${column.isAutoIncrement?then('YES', '')} | ${column.isNullable?then(column.defaultValue!'NULL', column.defaultValue!'')} | ${column.comment!''} |
|
||||
</#list>
|
||||
| seq | name | type | nullable | auto increment| default | comment |
|
||||
| ---- | ------ | ------ | ------ | -------- | ------ | ------ |
|
||||
<#list table.columns as column>
|
||||
| ${column_index+1} | ${column.name} | ${column.type} | ${column.isNullable?then('YES','NO')} | ${column.isAutoIncrement?then('YES', 'NO')} | ${column.isNullable?then(column.defaultValue!'NULL', column.defaultValue!'')} | ${column.comment!''} |
|
||||
</#list>
|
||||
</#if>
|
||||
|
||||
<#if config.renderIndexes>
|
||||
|
@ -25,9 +25,9 @@
|
|||
|
||||
| seq | name | unique | primary key | columns |
|
||||
| ---- | ---- | -------- | -------- | ------ |
|
||||
<#list table.indexes as index>
|
||||
| ${index_index+1} | ${index.indexName} | ${index.isUniqueKey?then('YES', '')} | ${index.isPrimaryKey?then('YES','')} | ${index.columnNames?join(', ')} |
|
||||
</#list>
|
||||
<#list table.indexes as index>
|
||||
| ${index_index+1} | ${index.name} | ${index.isUniqueKey?then('YES', 'NO')} | ${index.isPrimaryKey?then('YES','NO')} | ${index.columnNames?join(', ')} |
|
||||
</#list>
|
||||
</#if>
|
||||
|
||||
<#if config.renderTriggers>
|
||||
|
|
Loading…
Reference in New Issue