Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: generator模板生成优化,增加表注释变量,去除多余换行 #919

Merged
merged 1 commit into from
Jul 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading