添加pojo功能readme,修改默认模板

This commit is contained in:
liuyueve
2020-08-24 20:49:42 +08:00
parent 55cd438c13
commit 81a3c95cae
3 changed files with 99 additions and 8 deletions

View File

@@ -29,6 +29,7 @@ import cn.smallbun.screw.extension.pojo.process.PojoModelProcess;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.File;
import java.util.List;
/**
@@ -64,12 +65,19 @@ public class PojoExecute implements Execute {
PojoEngine pojoEngine = new FreeMarkerPojoEngine();
//确认路径
String path = configuration.getPath();
if (!path.startsWith("/")) {
path = "/" + path;
}
if (!path.endsWith("/")) {
path = path + "/";
}
File pathFile = new File(path);
if (!pathFile.exists()) {
boolean mkdir = pathFile.mkdir();
if (!mkdir) {
throw new ScrewException("create directory failed");
}
}
if (!pathFile.isDirectory()) {
throw new ScrewException("path is not a directory");
}
//逐个产生文档
for (PojoModel pojoModel : process) {
pojoEngine.produce(pojoModel, path + pojoModel.getClassName() + ".java");

View File

@@ -12,9 +12,9 @@ import lombok.Data;
</#if>
/**
* 数据库表名: ${tableName}
* table name: ${tableName}
<#if (remarks)??&&remarks?length gt 0>
* 数据库表注释: ${remarks}
* table comment: ${remarks}
</#if>
*/
<#if useLombok>
@@ -25,9 +25,9 @@ public class ${className} {
<#items as field>
<#if (field.remarks)??&&field.remarks?length gt 0>
//数据库字段注释: ${field.remarks}
//comment: ${field.remarks}
</#if>
//数据库字段类型: ${field.fieldType},数据库字段名: ${field.fieldName}
//name: ${field.fieldName},type: ${field.fieldType}
private ${field.classType} ${field.className};
</#items>