mirror of
https://gitee.com/mybatis-flex/mybatis-flex.git
synced 2025-12-07 00:58:24 +08:00
refactor: 注释命名由 remarks 改为 comment (ALTER TABLE user COMMENT = '用户信息表';)。
This commit is contained in:
parent
1fbd11cfd8
commit
04c6a363b9
@ -100,7 +100,7 @@ public class Generator {
|
||||
table.setName(tableName);
|
||||
|
||||
String remarks = rs.getString("REMARKS");
|
||||
table.setRemarks(remarks);
|
||||
table.setComment(remarks);
|
||||
|
||||
|
||||
buildPrimaryKey(table);
|
||||
|
||||
@ -27,7 +27,7 @@ public class JavadocConfig {
|
||||
/**
|
||||
* 表名格式化。
|
||||
*/
|
||||
private Function<String, String> tableRemarkFormat = Function.identity();
|
||||
private Function<String, String> tableCommentFormat = Function.identity();
|
||||
|
||||
public String getAuthor() {
|
||||
return author;
|
||||
@ -53,15 +53,15 @@ public class JavadocConfig {
|
||||
}
|
||||
|
||||
public String formatTableComment(String comment) {
|
||||
return tableRemarkFormat.apply(comment);
|
||||
return tableCommentFormat.apply(comment);
|
||||
}
|
||||
|
||||
public Function<String, String> getTableRemarkFormat() {
|
||||
return tableRemarkFormat;
|
||||
public Function<String, String> getTableCommentFormat() {
|
||||
return tableCommentFormat;
|
||||
}
|
||||
|
||||
public JavadocConfig setTableRemarkFormat(Function<String, String> tableRemarkFormat) {
|
||||
this.tableRemarkFormat = tableRemarkFormat;
|
||||
public JavadocConfig setTableCommentFormat(Function<String, String> tableCommentFormat) {
|
||||
this.tableCommentFormat = tableCommentFormat;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
@ -45,7 +45,7 @@ public abstract class JdbcDialect implements IDialect {
|
||||
column.setAutoIncrement(columnMetaData.isAutoIncrement(i));
|
||||
|
||||
//注释
|
||||
column.setRemarks(columnRemarks.get(column.getName()));
|
||||
column.setComment(columnRemarks.get(column.getName()));
|
||||
|
||||
table.addColumn(column);
|
||||
}
|
||||
|
||||
@ -30,7 +30,7 @@ public class Column {
|
||||
private String property;
|
||||
private String propertyType;
|
||||
|
||||
private String remarks;
|
||||
private String comment;
|
||||
|
||||
private boolean isPrimaryKey = false;
|
||||
private Boolean isAutoIncrement;
|
||||
@ -63,12 +63,12 @@ public class Column {
|
||||
this.propertyType = propertyType;
|
||||
}
|
||||
|
||||
public String getRemarks() {
|
||||
return remarks;
|
||||
public String getComment() {
|
||||
return comment;
|
||||
}
|
||||
|
||||
public void setRemarks(String remarks) {
|
||||
this.remarks = remarks;
|
||||
public void setComment(String comment) {
|
||||
this.comment = comment;
|
||||
}
|
||||
|
||||
public boolean isPrimaryKey() {
|
||||
@ -104,12 +104,12 @@ public class Column {
|
||||
}
|
||||
|
||||
|
||||
public String buildRemarks(){
|
||||
if (StringUtil.isBlank(remarks)){
|
||||
public String buildComment(){
|
||||
if (StringUtil.isBlank(comment)){
|
||||
return "";
|
||||
}else {
|
||||
StringBuilder sb = new StringBuilder("/**\n")
|
||||
.append(" * ").append(remarks).append("\n")
|
||||
.append(" * ").append(comment).append("\n")
|
||||
.append(" */");
|
||||
return sb.toString();
|
||||
}
|
||||
@ -280,7 +280,7 @@ public class Column {
|
||||
return "Column{" +
|
||||
"name='" + name + '\'' +
|
||||
", className='" + propertyType + '\'' +
|
||||
", remarks='" + remarks + '\'' +
|
||||
", remarks='" + comment + '\'' +
|
||||
", isAutoIncrement=" + isAutoIncrement +
|
||||
'}';
|
||||
}
|
||||
|
||||
@ -25,7 +25,7 @@ import java.util.stream.Collectors;
|
||||
public class Table {
|
||||
|
||||
private String name;
|
||||
private String remarks;
|
||||
private String comment;
|
||||
private Set<String> primaryKeys;
|
||||
private List<Column> columns = new ArrayList<>();
|
||||
|
||||
@ -40,12 +40,12 @@ public class Table {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getRemarks() {
|
||||
return globalConfig.getJavadocConfig().formatTableComment(remarks);
|
||||
public String getComment() {
|
||||
return globalConfig.getJavadocConfig().formatTableComment(comment);
|
||||
}
|
||||
|
||||
public void setRemarks(String remarks) {
|
||||
this.remarks = remarks;
|
||||
public void setComment(String comment) {
|
||||
this.comment = comment;
|
||||
}
|
||||
|
||||
|
||||
@ -295,7 +295,7 @@ public class Table {
|
||||
public String toString() {
|
||||
return "Table{" +
|
||||
"name='" + name + '\'' +
|
||||
", remarks='" + remarks + '\'' +
|
||||
", remarks='" + comment + '\'' +
|
||||
", primaryKeys='" + primaryKeys + '\'' +
|
||||
", columns=" + columns +
|
||||
'}';
|
||||
|
||||
@ -11,7 +11,7 @@ import #(controllerConfig.buildSuperClassImport())
|
||||
#end
|
||||
|
||||
/**
|
||||
* #(table.getRemarks()) 控制层。
|
||||
* #(table.getComment()) 控制层。
|
||||
*
|
||||
* @author #(javadocConfig.getAuthor())
|
||||
* @since #(javadocConfig.getSince())
|
||||
|
||||
@ -5,7 +5,7 @@ import #(importClass);
|
||||
#end
|
||||
|
||||
/**
|
||||
* #(table.getRemarks()) 实体类。
|
||||
* #(table.getComment()) 实体类。
|
||||
*
|
||||
* @author #(javadocConfig.getAuthor())
|
||||
* @since #(javadocConfig.getSince())
|
||||
@ -14,7 +14,7 @@ import #(importClass);
|
||||
public class #(table.buildEntityClassName())#(table.buildExtends())#(table.buildImplements()) {
|
||||
#for(column: table.columns)
|
||||
|
||||
#(column.buildRemarks())
|
||||
#(column.buildComment())
|
||||
#(column.buildAnnotations())private #(column.propertySimpleType) #(column.property);
|
||||
#end
|
||||
|
||||
|
||||
@ -4,7 +4,7 @@ import #(mapperConfig.buildSuperClassImport());
|
||||
import #(packageConfig.entityPackage).#(table.buildEntityClassName());
|
||||
|
||||
/**
|
||||
* #(table.getRemarks()) 映射层。
|
||||
* #(table.getComment()) 映射层。
|
||||
*
|
||||
* @author #(javadocConfig.getAuthor())
|
||||
* @since #(javadocConfig.getSince())
|
||||
|
||||
@ -4,7 +4,7 @@ import #(serviceConfig.buildSuperClassImport());
|
||||
import #(packageConfig.entityPackage).#(table.buildEntityClassName());
|
||||
|
||||
/**
|
||||
* #(table.getRemarks()) 服务层。
|
||||
* #(table.getComment()) 服务层。
|
||||
*
|
||||
* @author #(javadocConfig.getAuthor())
|
||||
* @since #(javadocConfig.getSince())
|
||||
|
||||
@ -7,7 +7,7 @@ import #(packageConfig.servicePackage).#(table.buildServiceClassName());
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* #(table.getRemarks()) 服务层实现。
|
||||
* #(table.getComment()) 服务层实现。
|
||||
*
|
||||
* @author #(javadocConfig.getAuthor())
|
||||
* @since #(javadocConfig.getSince())
|
||||
|
||||
@ -4,7 +4,7 @@ import com.mybatisflex.core.query.QueryColumn;
|
||||
import com.mybatisflex.core.table.TableDef;
|
||||
|
||||
/**
|
||||
* #(table.getRemarks()) 表定义层。
|
||||
* #(table.getComment()) 表定义层。
|
||||
*
|
||||
* @author #(javadocConfig.getAuthor())
|
||||
* @since #(javadocConfig.getSince())
|
||||
|
||||
@ -103,7 +103,7 @@ public class GeneratorTest {
|
||||
//设置注解生成配置
|
||||
globalConfig.getJavadocConfig()
|
||||
.setAuthor("王帅")
|
||||
.setTableRemarkFormat(format);
|
||||
.setTableCommentFormat(format);
|
||||
|
||||
//设置生成文件目录和根包
|
||||
globalConfig.getPackageConfig()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user