Commit 622f1c1b authored by 孙长纪's avatar 孙长纪

废弃项目

parent d56beaf2
......@@ -7,7 +7,7 @@ import cn.com.duiba.duiba.generator.gencode.JavaDaoGenerator;
import cn.com.duiba.duiba.generator.gencode.JavaDaoImplGenerator;
import cn.com.duiba.duiba.generator.gencode.JavaEntityGenerator;
import cn.com.duiba.duiba.generator.gencode.SQLXmlGenerator;
import cn.com.duiba.duiba.generator.services.DuibaFreemarkerService;
import cn.com.duiba.duiba.generator.tpls.DuibaFreemarkerService;
import cn.com.duiba.duiba.generator.utils.DBUtils;
import java.sql.Connection;
......
package cn.com.duiba.duiba.generator.exceptions;
public class DuibaGeneratorException extends RuntimeException{
public class DuibaGeneratorException extends RuntimeException {
private static final long serialVersionUID = -1832371381972592054L;
......@@ -11,5 +11,4 @@ public class DuibaGeneratorException extends RuntimeException{
public DuibaGeneratorException(Throwable cause) {
super(cause);
}
}
......@@ -3,7 +3,7 @@ package cn.com.duiba.duiba.generator.gencode;
import cn.com.duiba.duiba.generator.entity.GeneratorConfig;
import cn.com.duiba.duiba.generator.entity.TableEntity;
import cn.com.duiba.duiba.generator.exceptions.DuibaGeneratorException;
import cn.com.duiba.duiba.generator.services.DuibaFreemarkerService;
import cn.com.duiba.duiba.generator.tpls.DuibaFreemarkerService;
import org.apache.commons.io.IOUtils;
import java.io.File;
......
......@@ -2,7 +2,7 @@ package cn.com.duiba.duiba.generator.gencode;
import cn.com.duiba.duiba.generator.entity.GeneratorConfig;
import cn.com.duiba.duiba.generator.entity.TableEntity;
import cn.com.duiba.duiba.generator.services.DuibaFreemarkerService;
import cn.com.duiba.duiba.generator.tpls.DuibaFreemarkerService;
import cn.com.duiba.duiba.generator.utils.PathUtils;
public class JavaDaoGenerator extends AbstractGenerator{
......
......@@ -2,7 +2,7 @@ package cn.com.duiba.duiba.generator.gencode;
import cn.com.duiba.duiba.generator.entity.GeneratorConfig;
import cn.com.duiba.duiba.generator.entity.TableEntity;
import cn.com.duiba.duiba.generator.services.DuibaFreemarkerService;
import cn.com.duiba.duiba.generator.tpls.DuibaFreemarkerService;
import cn.com.duiba.duiba.generator.utils.PathUtils;
/**
......
......@@ -2,7 +2,7 @@ package cn.com.duiba.duiba.generator.gencode;
import cn.com.duiba.duiba.generator.entity.GeneratorConfig;
import cn.com.duiba.duiba.generator.entity.TableEntity;
import cn.com.duiba.duiba.generator.services.DuibaFreemarkerService;
import cn.com.duiba.duiba.generator.tpls.DuibaFreemarkerService;
import cn.com.duiba.duiba.generator.utils.PathUtils;
/**
......
......@@ -2,7 +2,7 @@ package cn.com.duiba.duiba.generator.gencode;
import cn.com.duiba.duiba.generator.entity.GeneratorConfig;
import cn.com.duiba.duiba.generator.entity.TableEntity;
import cn.com.duiba.duiba.generator.services.DuibaFreemarkerService;
import cn.com.duiba.duiba.generator.tpls.DuibaFreemarkerService;
public class SQLXmlGenerator extends AbstractGenerator{
......
package cn.com.duiba.duiba.generator.services;
package cn.com.duiba.duiba.generator.tpls;
import freemarker.template.Configuration;
import freemarker.template.DefaultObjectWrapper;
......@@ -11,19 +11,17 @@ import java.io.OutputStreamWriter;
import java.util.Map;
/**
* FreeMarker模板
* FreeMarker模板
*
* @author sunchangji
*/
public class DuibaFreemarkerService {
private String location;
private String suffix;
private Configuration cfg = new Configuration();
private String encoding = "utf-8";
public DuibaFreemarkerService(){
public DuibaFreemarkerService() {
cfg.setDefaultEncoding(encoding);
cfg.setClassForTemplateLoading(DuibaFreemarkerService.class, "");
cfg.setObjectWrapper(new DefaultObjectWrapper());
......@@ -31,17 +29,17 @@ public class DuibaFreemarkerService {
this.location = "";
this.suffix = "ftl";
}
public String merge(String template, Map<String, Object> model) {
try {
Template tpl = cfg.getTemplate(template+"."+suffix);
Template tpl = cfg.getTemplate(template + "." + suffix);
ByteArrayOutputStream bos = new ByteArrayOutputStream();
OutputStreamWriter writer = new OutputStreamWriter(bos);
tpl.process(model, writer);
writer.flush();
writer.close();
byte[] byteArray = bos.toByteArray();
return new String(byteArray,encoding);
return new String(byteArray, encoding);
} catch (IOException | TemplateException e) {
throw new RuntimeException(e);
}
......
......@@ -12,7 +12,7 @@ public class CodeGeneratorTest {
String pwd = "dev_fas015";
GeneratorConfig config = new GeneratorConfig(DB_URL, user, pwd);
config.setDaoPackage("cn.com.duiba.shark.mybatis.generator.test.dao");
config.setDaoPackage("cn.com.duiba..mybatis.generator.test.dao");
config.setEntityPackage("cn.com.duiba.shark.mybatis.generator.test.entity");
config.setXmlLocation("src/main/resources");
config.setTableSchema("act_com_conf");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment