From ea726b00693140be639ef4ccd84fe517f6e301d9 Mon Sep 17 00:00:00 2001 From: zhenggm Date: Tue, 16 Aug 2022 18:07:31 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=EF=BC=9ALC=5FSINGLE=E6=A8=A1?= =?UTF-8?q?=E5=9E=8Bengine?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/cc/smtweb/system/bpm/util/CodeGenerator.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/util/CodeGenerator.java b/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/util/CodeGenerator.java index de3f9f9..9ef2ad1 100644 --- a/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/util/CodeGenerator.java +++ b/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/util/CodeGenerator.java @@ -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 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()); } }