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

废弃项目

parent d56beaf2
...@@ -7,7 +7,7 @@ import cn.com.duiba.duiba.generator.gencode.JavaDaoGenerator; ...@@ -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.JavaDaoImplGenerator;
import cn.com.duiba.duiba.generator.gencode.JavaEntityGenerator; import cn.com.duiba.duiba.generator.gencode.JavaEntityGenerator;
import cn.com.duiba.duiba.generator.gencode.SQLXmlGenerator; 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 cn.com.duiba.duiba.generator.utils.DBUtils;
import java.sql.Connection; import java.sql.Connection;
......
package cn.com.duiba.duiba.generator.exceptions; package cn.com.duiba.duiba.generator.exceptions;
public class DuibaGeneratorException extends RuntimeException{ public class DuibaGeneratorException extends RuntimeException {
private static final long serialVersionUID = -1832371381972592054L; private static final long serialVersionUID = -1832371381972592054L;
...@@ -11,5 +11,4 @@ public class DuibaGeneratorException extends RuntimeException{ ...@@ -11,5 +11,4 @@ public class DuibaGeneratorException extends RuntimeException{
public DuibaGeneratorException(Throwable cause) { public DuibaGeneratorException(Throwable cause) {
super(cause); super(cause);
} }
} }
...@@ -3,7 +3,7 @@ package cn.com.duiba.duiba.generator.gencode; ...@@ -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.GeneratorConfig;
import cn.com.duiba.duiba.generator.entity.TableEntity; import cn.com.duiba.duiba.generator.entity.TableEntity;
import cn.com.duiba.duiba.generator.exceptions.DuibaGeneratorException; 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 org.apache.commons.io.IOUtils;
import java.io.File; import java.io.File;
......
...@@ -2,7 +2,7 @@ package cn.com.duiba.duiba.generator.gencode; ...@@ -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.GeneratorConfig;
import cn.com.duiba.duiba.generator.entity.TableEntity; 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; import cn.com.duiba.duiba.generator.utils.PathUtils;
public class JavaDaoGenerator extends AbstractGenerator{ public class JavaDaoGenerator extends AbstractGenerator{
......
...@@ -2,7 +2,7 @@ package cn.com.duiba.duiba.generator.gencode; ...@@ -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.GeneratorConfig;
import cn.com.duiba.duiba.generator.entity.TableEntity; 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; import cn.com.duiba.duiba.generator.utils.PathUtils;
/** /**
......
...@@ -2,7 +2,7 @@ package cn.com.duiba.duiba.generator.gencode; ...@@ -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.GeneratorConfig;
import cn.com.duiba.duiba.generator.entity.TableEntity; 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; import cn.com.duiba.duiba.generator.utils.PathUtils;
/** /**
......
...@@ -2,7 +2,7 @@ package cn.com.duiba.duiba.generator.gencode; ...@@ -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.GeneratorConfig;
import cn.com.duiba.duiba.generator.entity.TableEntity; 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{ 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.Configuration;
import freemarker.template.DefaultObjectWrapper; import freemarker.template.DefaultObjectWrapper;
...@@ -12,18 +12,16 @@ import java.util.Map; ...@@ -12,18 +12,16 @@ import java.util.Map;
/** /**
* FreeMarker模板 * FreeMarker模板
*
* @author sunchangji
*/ */
public class DuibaFreemarkerService { public class DuibaFreemarkerService {
private String location; private String location;
private String suffix; private String suffix;
private Configuration cfg = new Configuration(); private Configuration cfg = new Configuration();
private String encoding = "utf-8"; private String encoding = "utf-8";
public DuibaFreemarkerService(){ public DuibaFreemarkerService() {
cfg.setDefaultEncoding(encoding); cfg.setDefaultEncoding(encoding);
cfg.setClassForTemplateLoading(DuibaFreemarkerService.class, ""); cfg.setClassForTemplateLoading(DuibaFreemarkerService.class, "");
cfg.setObjectWrapper(new DefaultObjectWrapper()); cfg.setObjectWrapper(new DefaultObjectWrapper());
...@@ -34,14 +32,14 @@ public class DuibaFreemarkerService { ...@@ -34,14 +32,14 @@ public class DuibaFreemarkerService {
public String merge(String template, Map<String, Object> model) { public String merge(String template, Map<String, Object> model) {
try { try {
Template tpl = cfg.getTemplate(template+"."+suffix); Template tpl = cfg.getTemplate(template + "." + suffix);
ByteArrayOutputStream bos = new ByteArrayOutputStream(); ByteArrayOutputStream bos = new ByteArrayOutputStream();
OutputStreamWriter writer = new OutputStreamWriter(bos); OutputStreamWriter writer = new OutputStreamWriter(bos);
tpl.process(model, writer); tpl.process(model, writer);
writer.flush(); writer.flush();
writer.close(); writer.close();
byte[] byteArray = bos.toByteArray(); byte[] byteArray = bos.toByteArray();
return new String(byteArray,encoding); return new String(byteArray, encoding);
} catch (IOException | TemplateException e) { } catch (IOException | TemplateException e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} }
......
...@@ -12,7 +12,7 @@ public class CodeGeneratorTest { ...@@ -12,7 +12,7 @@ public class CodeGeneratorTest {
String pwd = "dev_fas015"; String pwd = "dev_fas015";
GeneratorConfig config = new GeneratorConfig(DB_URL, user, pwd); 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.setEntityPackage("cn.com.duiba.shark.mybatis.generator.test.entity");
config.setXmlLocation("src/main/resources"); config.setXmlLocation("src/main/resources");
config.setTableSchema("act_com_conf"); 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