Browse Source

增加:LC_SINGLE模型engine

4.0
郑根木 2 years ago
parent
commit
ea726b0069
1 changed files with 5 additions and 5 deletions
  1. +5
    -5
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/util/CodeGenerator.java

+ 5
- 5
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/util/CodeGenerator.java View File

@@ -22,8 +22,8 @@ import java.util.Map;
*/
public class CodeGenerator {
private final static String KEY_MODEL = "model";
private final static String TEMPLATE_JAVA_BEAN = "java_bean";
private final static String TEMPLATE_JAVA_CACHE = "java_cache";
private final static String TEMPLATE_JAVA_BEAN = "../java_bean";
private final static String TEMPLATE_JAVA_CACHE = "../java_cache";
private final static String TEMPLATE_JAVA_SERVICE = "java_service";
private final static String TEMPLATE_JS_EVENT = "js_event";
private static CodeGenerator instance = null;
@@ -42,7 +42,7 @@ public class CodeGenerator {
mapTemplate = YamlUtil.readValue(this.getClass().getResourceAsStream("/static/template/" + SwConsts.modelPath + "/index.yaml"), SwMap.class);
configuration = new Configuration(Configuration.VERSION_2_3_31);
try {
configuration.setClassForTemplateLoading(this.getClass(), "/static/template/");
configuration.setClassForTemplateLoading(this.getClass(), "/static/template/" + SwConsts.modelPath);
// configuration.setDirectoryForTemplateLoading(new File(templatesDir));
configuration.setClassicCompatible(true);
configuration.setDefaultEncoding(encode);
@@ -98,7 +98,7 @@ public class CodeGenerator {

public String generate(Map<String, Object> model, String templateName) {
StringWriter out = new StringWriter();
generate(model, SwConsts.modelPath + "/" + templateName + ".ftl", out);
generate(model, templateName + ".ftl", out);
return out.getBuffer().toString();
}

@@ -196,7 +196,7 @@ public class CodeGenerator {

map.put("title", "thisIsATest!");
map.put("newId", new PKGenerator());
CodeGenerator.getInstance().generate(map, SwConsts.modelPath + "/model_card.ftl", out);
CodeGenerator.getInstance().generate(map, "model_card.ftl", out);
System.out.println(out.getBuffer().toString());
}
}

Loading…
Cancel
Save