Skip to content

Commit

Permalink
生成代码
Browse files Browse the repository at this point in the history
  • Loading branch information
shuaje committed May 1, 2018
1 parent 51603f1 commit 6ab7b6b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 20 deletions.
21 changes: 8 additions & 13 deletions iBase4J-SYS-Service/src/main/java/org/ibase4j/Generator.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

/**
* 代码生成 注意:不生成service接口 注意:不生成service接口 注意:不生成service接口
*
*
* @author ShenHuaJie
*/
public class Generator {
Expand All @@ -34,10 +34,6 @@ public static void main(String[] args) {
gc.setBaseColumnList(false);// XML columList
gc.setOpen(false);
gc.setAuthor("ShenHuaJie");
// 自定义文件命名,注意 %s 会自动填充表实体属性!
// gc.setMapperName("%sDao");
// gc.setXmlName("%sDao");
gc.setServiceImplName("%sService");
mpg.setGlobalConfig(gc);
// 数据源配置
DataSourceConfig dsc = new DataSourceConfig();
Expand Down Expand Up @@ -65,7 +61,7 @@ public static void main(String[] args) {
// 自定义 service 实现类父类
strategy.setSuperServiceImplClass("top.ibase4j.core.base.BaseService");
// 自定义 controller 父类
strategy.setSuperControllerClass("top.ibase4j.core.base.provider.BaseController");
strategy.setSuperControllerClass("top.ibase4j.core.base.BaseController");
// 【实体】是否生成字段常量(默认 false)
// public static final String ID = "test_id";
// strategy.setEntityColumnConstant(true);
Expand All @@ -76,11 +72,10 @@ public static void main(String[] args) {
mpg.setStrategy(strategy);
// 注入自定义配置,可以在 VM 中使用 cfg.abc 设置的值
InjectionConfig cfg = new InjectionConfig() {
@Override
public void initMap() {
Map<String, Object> map = new HashMap<String, Object>();
map.put("providerClass", "IBizProvider");
map.put("providerClassPackage", "org.xshop.provider.IBizProvider");
//map.put("rpcService", false);
map.put("rpcService", false);
this.setMap(map);
}
};
Expand All @@ -90,9 +85,9 @@ public void initMap() {
pc.setParent("org.ibase4j");
pc.setEntity("model");
pc.setMapper("mapper");
pc.setXml("mapper.xml");
pc.setService("service.i");
pc.setServiceImpl("service");
pc.setXml("mapper");
pc.setService("service");
pc.setServiceImpl("service.impl");
pc.setController("web");
mpg.setPackageInfo(pc);
// 放置自己项目的 src/main/resources/template 目录下, 默认名称一下可以不配置,也可以自定义模板名称
Expand All @@ -101,7 +96,7 @@ public void initMap() {
tc.setMapper("tpl/mapper.java.vm");
tc.setXml("tpl/mapper.xml.vm");
tc.setService("tpl/iservice.java.vm");
tc.setServiceImpl("tpl/service.java.vm");
tc.setServiceImpl("tpl/serviceImpl.java.vm");
tc.setController("tpl/controller.java.vm");
mpg.setTemplate(tc);
// 执行生成
Expand Down
14 changes: 7 additions & 7 deletions iBase4J-SYS-Service/src/main/resources/config/jdbc.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ druid.driverClassName=com.mysql.cj.jdbc.Driver
#\u5bc6\u94a5(\u4f7f\u7528\u65b9\u5f0f\u67e5\u770btop.ibase4j.core.config.Configs)
druid.key=
#\u8bfb
druid.reader.url=jdbc:mysql://${jdbc.host}:3306/ibase4j?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&serverTimezone=PRC&useSSL=false
druid.reader.url=jdbc:mysql://${jdbc.host}:3306/ibase4j\u003fuseUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&serverTimezone=PRC&useSSL=false
druid.reader.username=root
#\u914d\u7f6ePropertiesUtil\u89e3\u5bc6
druid.reader.password=${jdbc.password}
#\u5199
druid.writer.url=jdbc:mysql://${jdbc.host}:3306/ibase4j?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&serverTimezone=PRC&useSSL=false
druid.writer.url=jdbc:mysql://${jdbc.host}:3306/ibase4j\u003fuseUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&serverTimezone=PRC&useSSL=false
druid.writer.username=root
#\u914d\u7f6ePropertiesUtil\u89e3\u5bc6
druid.writer.password=${jdbc.password}
Expand All @@ -19,8 +19,8 @@ druid.initialSize=5
druid.maxActive=20

# Mybatis\u914d\u7f6e
mybatis.dialectType: mysql
mybatis.typeAliasesPackage: *.*.model*
mybatis.mapperLocations: classpath*:**/mapper/xml/*.xml
mybatis.mapperBasePackage: *.*.mapper
mybatis.idType: AUTO
mybatis.dialectType=mysql
mybatis.typeAliasesPackage=*.*.model*
mybatis.mapperLocations=classpath*:**/mapper/xml/*.xml
mybatis.mapperBasePackage=*.*.mapper
mybatis.idType=AUTO

0 comments on commit 6ab7b6b

Please sign in to comment.