makeHtml改名为makeFile
This commit is contained in:
parent
2490c388d9
commit
c014c9e90f
|
|
@ -26,31 +26,31 @@ import com.smallchill.core.toolbox.kit.FileKit;
|
||||||
/**
|
/**
|
||||||
* Beetl静态化生成工具类
|
* Beetl静态化生成工具类
|
||||||
*/
|
*/
|
||||||
public abstract class BeetlMaker {
|
public class BeetlMaker {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 生成静态html
|
* 生成文件
|
||||||
*
|
*
|
||||||
* @param ftlPath 模板路径
|
* @param tlPath 模板路径
|
||||||
* @param paras 参数
|
* @param paras 参数
|
||||||
* @param htmlPath html文件保存路径
|
* @param filePath 文件保存路径
|
||||||
*/
|
*/
|
||||||
public static void makeHtml(String tlPath, Map<String, Object> paras, String htmlPath) {
|
public static void makeFile(String tlPath, Map<String, Object> paras, String filePath) {
|
||||||
makeHtml(tlPath, paras, htmlPath, CharsetKit.UTF_8);
|
makeFile(tlPath, paras, filePath, CharsetKit.UTF_8);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 生成静态html
|
* 生成文件
|
||||||
*
|
*
|
||||||
* @param ftlPath 模板路径
|
* @param tlPath 模板路径
|
||||||
* @param paras 参数
|
* @param paras 参数
|
||||||
* @param htmlPath html文件保存路径
|
* @param filePath 文件保存路径
|
||||||
* @param charsetName 编码
|
* @param charsetName 编码
|
||||||
*/
|
*/
|
||||||
public static void makeHtml(String tlPath, Map<String, Object> paras, String htmlPath, String charsetName) {
|
public static void makeFile(String tlPath, Map<String, Object> paras, String filePath, String charsetName) {
|
||||||
PrintWriter pw = null;
|
PrintWriter pw = null;
|
||||||
try {
|
try {
|
||||||
pw = new PrintWriter(new OutputStreamWriter(new FileOutputStream(htmlPath), charsetName));
|
pw = new PrintWriter(new OutputStreamWriter(new FileOutputStream(filePath), charsetName));
|
||||||
BeetlTemplate.buildTo(FileKit.readString(tlPath, charsetName), paras, pw);
|
BeetlTemplate.buildTo(FileKit.readString(tlPath, charsetName), paras, pw);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
|
|
||||||
|
|
@ -180,20 +180,20 @@ public class GenerateController extends CurdController<Generate> {
|
||||||
ps.set("pkName", pkName);
|
ps.set("pkName", pkName);
|
||||||
|
|
||||||
//java
|
//java
|
||||||
BeetlMaker.makeHtml(controllerTemplatePath, ps, controllerPath);
|
BeetlMaker.makeFile(controllerTemplatePath, ps, controllerPath);
|
||||||
BeetlMaker.makeHtml(serviceTemplatePath, ps, servicePath);
|
BeetlMaker.makeFile(serviceTemplatePath, ps, servicePath);
|
||||||
BeetlMaker.makeHtml(serviceimplTemplatePath, ps, serviceimplPath);
|
BeetlMaker.makeFile(serviceimplTemplatePath, ps, serviceimplPath);
|
||||||
setParasAttr(tableName, ps);
|
setParasAttr(tableName, ps);
|
||||||
BeetlMaker.makeHtml(modelTemplatePath, ps, modelPath);
|
BeetlMaker.makeFile(modelTemplatePath, ps, modelPath);
|
||||||
|
|
||||||
//resources
|
//resources
|
||||||
BeetlMaker.makeHtml(sqlTemplatePath, ps, sqlPath);
|
BeetlMaker.makeFile(sqlTemplatePath, ps, sqlPath);
|
||||||
|
|
||||||
//webapp
|
//webapp
|
||||||
BeetlMaker.makeHtml(indexTemplatePath, ps, indexPath);
|
BeetlMaker.makeFile(indexTemplatePath, ps, indexPath);
|
||||||
BeetlMaker.makeHtml(addTemplatePath, ps, addPath);
|
BeetlMaker.makeFile(addTemplatePath, ps, addPath);
|
||||||
BeetlMaker.makeHtml(editTemplatePath, ps, editPath);
|
BeetlMaker.makeFile(editTemplatePath, ps, editPath);
|
||||||
BeetlMaker.makeHtml(viewTemplatePath, ps, viewPath);
|
BeetlMaker.makeFile(viewTemplatePath, ps, viewPath);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user