public class GenApplication {
private static String className = "Project";
private static String objName = "project";
private static String comment = "期日经验";
private static String basePath = "src/main/java/com/resume/";
public static void main(String[] args) throws IOException, TemplateException {
// 生成Service接口
genService(className, objName, comment);
}
/**
* 生成Service接口
*
* @param className
* @param objName
* @throws IOException
* @throws TemplateException
*/
private static void genService(String className, String objName, String comment) throws IOException, TemplateException {
String ftlNameWithPath = basePath + "utils/gen/ftl/service.ftl";
String aimFileName = basePath + "service/" + className + "Service.java";
Map<String, Object> map = new HashMap<>();
map.put("objName", objName);
map.put("className", className);
map.put("comment", comment);
FreemarkerUtil.execute(ftlNameWithPath, map, aimFileName);
}
}
|