mirror of
https://gitee.com/mybatis-flex/mybatis-flex.git
synced 2025-12-07 00:58:24 +08:00
codegen add comment generate support. close #I6XKOP
This commit is contained in:
parent
6b31853046
commit
04842a05a9
@ -49,6 +49,9 @@ Row row = Db.selectOneBySql("select * from ....");
|
|||||||
Account entity = row.toEntity(Account.class);
|
Account entity = row.toEntity(Account.class);
|
||||||
```
|
```
|
||||||
|
|
||||||
|
需要注意的是,当我们进行 join 关联查询时,返回的结果如果出现重复字段,Row 会自动添加上 字段序号。
|
||||||
|
|
||||||
|
|
||||||
## Row.toObject()
|
## Row.toObject()
|
||||||
|
|
||||||
`Row.toObject(Other.class)` 和 `Row.toEntity(Entity.class)` 和相似。不一样的地方在于 `Row.toObject(Other.class)` 是通过去查找
|
`Row.toObject(Other.class)` 和 `Row.toEntity(Entity.class)` 和相似。不一样的地方在于 `Row.toObject(Other.class)` 是通过去查找
|
||||||
|
|||||||
@ -80,6 +80,7 @@ public class Generator {
|
|||||||
|
|
||||||
File mapperJavaFile = new File(globalConfig.getSourceDir(), mapperPackagePath + "/" +
|
File mapperJavaFile = new File(globalConfig.getSourceDir(), mapperPackagePath + "/" +
|
||||||
table.buildMapperClassName() + ".java");
|
table.buildMapperClassName() + ".java");
|
||||||
|
|
||||||
if (!mapperJavaFile.getParentFile().exists()) {
|
if (!mapperJavaFile.getParentFile().exists()) {
|
||||||
if (!mapperJavaFile.getParentFile().mkdirs()) {
|
if (!mapperJavaFile.getParentFile().mkdirs()) {
|
||||||
throw new IllegalStateException("Can not mkdirs by dir: " + mapperJavaFile.getParentFile());
|
throw new IllegalStateException("Can not mkdirs by dir: " + mapperJavaFile.getParentFile());
|
||||||
|
|||||||
@ -103,6 +103,19 @@ public class Column {
|
|||||||
return "set" + StringUtil.firstCharToUpperCase(property);
|
return "set" + StringUtil.firstCharToUpperCase(property);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public String buildRemarks(){
|
||||||
|
if (StringUtil.isBlank(remarks)){
|
||||||
|
return "";
|
||||||
|
}else {
|
||||||
|
StringBuilder sb = new StringBuilder("/**\n")
|
||||||
|
.append(" * ").append(remarks).append("\n")
|
||||||
|
.append(" */");
|
||||||
|
return sb.toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public String buildPropertyName() {
|
public String buildPropertyName() {
|
||||||
String entityJavaFileName = name;
|
String entityJavaFileName = name;
|
||||||
return StringUtil.firstCharToLowerCase(StringUtil.underlineToCamel(entityJavaFileName));
|
return StringUtil.firstCharToLowerCase(StringUtil.underlineToCamel(entityJavaFileName));
|
||||||
|
|||||||
@ -9,6 +9,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.buildAnnotations())private #(column.propertySimpleType) #(column.property);
|
#(column.buildAnnotations())private #(column.propertySimpleType) #(column.property);
|
||||||
#end
|
#end
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user