Skip to content

Commit

Permalink
fix: generator模板生成优化,增加表注释变量,去除多余换行
Browse files Browse the repository at this point in the history
  • Loading branch information
gonghao committed Jul 10, 2024
1 parent da833c7 commit c167b60
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 1 deletion.
2 changes: 2 additions & 0 deletions generator/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,7 @@ ${key} - ${props[key]}
实体和表的信息:
表名:${tableClass.tableName}
表注释:${tableClass.remarks}
变量名:${tableClass.variableName}
小写名:${tableClass.lowerCaseName}
类名:${tableClass.shortClassName}
Expand Down Expand Up @@ -411,6 +412,7 @@ fileName - ${tableClass.shortClassName}Test.txt

实体和表的信息:
表名:user_info
表注释:用户信息表
变量名:userInfo
小写名:userinfo
类名:UserInfo
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,11 @@ protected String read(InputStream inputStream) throws IOException {
StringBuffer stringBuffer = new StringBuffer();
String line = reader.readLine();
while (line != null) {
stringBuffer.append(line).append("\n");
stringBuffer.append(line);
line = reader.readLine();
if (line != null) {
stringBuffer.append("\n");
}
}
return stringBuffer.toString();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ public class TableClass implements Serializable {
private String fullClassName;
private String packageName;
private FullyQualifiedJavaType type;
private String remarks;

private List<ColumnField> pkFields;
private List<ColumnField> baseFields;
Expand Down Expand Up @@ -147,4 +148,12 @@ public String getVariableName() {
public void setVariableName(String variableName) {
this.variableName = variableName;
}

public String getRemarks() {
return remarks;
}

public void setRemarks(String remarks) {
this.remarks = remarks;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ public class TableColumnBuilder {
public static TableClass build(IntrospectedTable introspectedTable) {
TableClass tableClass = new TableClass();
tableClass.setIntrospectedTable(introspectedTable);
tableClass.setRemarks(introspectedTable.getRemarks());

FullyQualifiedTable fullyQualifiedTable = introspectedTable.getFullyQualifiedTable();
tableClass.setTableName(fullyQualifiedTable.getIntrospectedTableName());
Expand Down
1 change: 1 addition & 0 deletions generator/src/main/resources/generator/test-all.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ ${dateTime?string["yyyy-MM-dd HH:mm:ss"]}
****************************************************************************************
实体和表的信息:
表名:${tableClass.tableName}
表注释:${tableClass.remarks}
变量名:${tableClass.variableName}
小写名:${tableClass.lowerCaseName}
类名:${tableClass.shortClassName}
Expand Down
1 change: 1 addition & 0 deletions generator/src/main/resources/generator/test-one.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ ${dateTime?string["yyyy-MM-dd HH:mm:ss"]}

实体和表的信息:
表名:${tableClass.tableName}
表注释:${tableClass.remarks}
变量名:${tableClass.variableName}
小写名:${tableClass.lowerCaseName}
类名:${tableClass.shortClassName}
Expand Down

0 comments on commit c167b60

Please sign in to comment.