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