记得上下班打卡 | git大法好,push需谨慎

Commit 7401d585 authored by anjiabin's avatar anjiabin

提交liquidnet-bus-qpi

parent 8cb05e2a
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent> <parent>
<artifactId>liquidnet-service-adam</artifactId> <artifactId>liquidnet-bus-api</artifactId>
<groupId>com.liquidnet</groupId> <groupId>com.liquidnet</groupId>
<version>1.0-SNAPSHOT</version> <version>1.0-SNAPSHOT</version>
</parent> </parent>
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent> <parent>
<artifactId>liquidnet-service-kylin</artifactId> <artifactId>liquidnet-bus-api</artifactId>
<groupId>com.liquidnet</groupId> <groupId>com.liquidnet</groupId>
<version>1.0-SNAPSHOT</version> <version>1.0-SNAPSHOT</version>
</parent> </parent>
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
<groupId>com.liquidnet</groupId> <groupId>com.liquidnet</groupId>
<artifactId>liquidnet-bus-api</artifactId> <artifactId>liquidnet-bus-api</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>pom</packaging> <packaging>pom</packaging>
<modules> <modules>
<module>liquidnet-service-adam-api</module> <module>liquidnet-service-adam-api</module>
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent> <parent>
<artifactId>liquidnet-service-adam</artifactId> <artifactId>liquidnet-bus-do</artifactId>
<groupId>com.liquidnet</groupId> <groupId>com.liquidnet</groupId>
<version>1.0-SNAPSHOT</version> <version>1.0-SNAPSHOT</version>
</parent> </parent>
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<artifactId>liquidnet-service-kylin-do-2</artifactId> <artifactId>liquidnet-service-kylin-do</artifactId>
</project> </project>
\ No newline at end of file
package com.liquidnet.service.kylin; //package com.liquidnet.service.kylin;
//
import com.baomidou.mybatisplus.core.toolkit.StringPool; //import com.baomidou.mybatisplus.core.toolkit.StringPool;
import com.baomidou.mybatisplus.generator.AutoGenerator; //import com.baomidou.mybatisplus.generator.AutoGenerator;
import com.baomidou.mybatisplus.generator.InjectionConfig; //import com.baomidou.mybatisplus.generator.InjectionConfig;
import com.baomidou.mybatisplus.generator.config.*; //import com.baomidou.mybatisplus.generator.config.*;
import com.baomidou.mybatisplus.generator.config.po.TableInfo; //import com.baomidou.mybatisplus.generator.config.po.TableInfo;
import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy; //import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy;
import com.baomidou.mybatisplus.generator.engine.FreemarkerTemplateEngine; //import com.baomidou.mybatisplus.generator.engine.FreemarkerTemplateEngine;
//
import java.util.ArrayList; //import java.util.ArrayList;
import java.util.List; //import java.util.List;
//
public class MybatisPlusCodeGenerator { //public class MybatisPlusCodeGenerator {
/** // /**
* @param moduleRootPath 项目模块根路径 到 /src 之前 ex:E:\projects\trlabs-bus-v1\trlabs-bus-service\trlabs-common\trlabs-mybatis // * @param moduleRootPath 项目模块根路径 到 /src 之前 ex:E:\projects\trlabs-bus-v1\trlabs-bus-service\trlabs-common\trlabs-mybatis
* @param dsc 数据源 // * @param dsc 数据源
* @param parentName 相当于业务模块名 com.liquidnet.service.kylin 全限定类名 // * @param parentName 相当于业务模块名 com.liquidnet.service.kylin 全限定类名
* @param tableNames 表名 // * @param tableNames 表名
*/ // */
public static void doGenerator(String moduleRootPath, // public static void doGenerator(String moduleRootPath,
DataSourceConfig dsc, // DataSourceConfig dsc,
String parentName, // String parentName,
String[] tableNames) { // String[] tableNames) {
AutoGenerator mpg = new AutoGenerator(); // AutoGenerator mpg = new AutoGenerator();
// 全局配置BankMybatisPlusCodeGenerator // // 全局配置BankMybatisPlusCodeGenerator
GlobalConfig gc = new GlobalConfig(); // GlobalConfig gc = new GlobalConfig();
gc.setOutputDir(moduleRootPath + "/src/main/java"); // gc.setOutputDir(moduleRootPath + "/src/main/java");
gc.setAuthor("liquidnet"); // gc.setAuthor("liquidnet");
gc.setOpen(false); // gc.setOpen(false);
// gc.setSwagger2(true); 实体属性 Swagger2 注解 // // gc.setSwagger2(true); 实体属性 Swagger2 注解
mpg.setGlobalConfig(gc); // mpg.setGlobalConfig(gc);
//
// 数据源配置 // // 数据源配置
mpg.setDataSource(dsc); // mpg.setDataSource(dsc);
//
// 包配置 // // 包配置
PackageConfig pc = new PackageConfig(); // PackageConfig pc = new PackageConfig();
pc.setParent(parentName); // pc.setParent(parentName);
mpg.setPackageInfo(pc); // mpg.setPackageInfo(pc);
//
// 自定义配置 // // 自定义配置
InjectionConfig cfg = new InjectionConfig() { // InjectionConfig cfg = new InjectionConfig() {
@Override // @Override
public void initMap() { // public void initMap() {
// to do nothing // // to do nothing
} // }
}; // };
//
// 如果模板引擎是 freemarker // // 如果模板引擎是 freemarker
String templatePath = "/templates/mapper.xml.ftl"; // String templatePath = "/templates/mapper.xml.ftl";
// 自定义输出配置 // // 自定义输出配置
List<FileOutConfig> focList = new ArrayList<>(); // List<FileOutConfig> focList = new ArrayList<>();
// 自定义配置会被优先输出 // // 自定义配置会被优先输出
focList.add(new FileOutConfig(templatePath) { // focList.add(new FileOutConfig(templatePath) {
@Override // @Override
public String outputFile(TableInfo tableInfo) { // public String outputFile(TableInfo tableInfo) {
// 自定义输出文件名 , 如果你 Entity 设置了前后缀、此处注意 xml 的名称会跟着发生变化!! // // 自定义输出文件名 , 如果你 Entity 设置了前后缀、此处注意 xml 的名称会跟着发生变化!!
return moduleRootPath + "/src/main/resources/com/liquidnet/service/kylin/mapper/" + pc.getModuleName() // return moduleRootPath + "/src/main/resources/com/liquidnet/service/kylin/mapper/" + pc.getModuleName()
+ "/" + tableInfo.getEntityName() + "Mapper" + StringPool.DOT_XML; // + "/" + tableInfo.getEntityName() + "Mapper" + StringPool.DOT_XML;
} // }
}); // });
cfg.setFileOutConfigList(focList); // cfg.setFileOutConfigList(focList);
mpg.setCfg(cfg); // mpg.setCfg(cfg);
//
// 配置模板 // // 配置模板
TemplateConfig templateConfig = new TemplateConfig(); // TemplateConfig templateConfig = new TemplateConfig();
//
templateConfig.setXml(null); // templateConfig.setXml(null);
mpg.setTemplate(templateConfig); // mpg.setTemplate(templateConfig);
//
// 策略配置 // // 策略配置
StrategyConfig strategy = new StrategyConfig(); // StrategyConfig strategy = new StrategyConfig();
strategy.setNaming(NamingStrategy.underline_to_camel); // strategy.setNaming(NamingStrategy.underline_to_camel);
strategy.setColumnNaming(NamingStrategy.underline_to_camel); // strategy.setColumnNaming(NamingStrategy.underline_to_camel);
// strategy.setSuperEntityClass("你自己的父类实体,没有就不用设置!"); // // strategy.setSuperEntityClass("你自己的父类实体,没有就不用设置!");
strategy.setEntityLombokModel(true); // strategy.setEntityLombokModel(true);
strategy.setRestControllerStyle(true); // strategy.setRestControllerStyle(true);
strategy.setInclude(tableNames); // strategy.setInclude(tableNames);
strategy.setControllerMappingHyphenStyle(true); // strategy.setControllerMappingHyphenStyle(true);
strategy.setTablePrefix(pc.getModuleName() + "_"); // strategy.setTablePrefix(pc.getModuleName() + "_");
mpg.setStrategy(strategy); // mpg.setStrategy(strategy);
mpg.setTemplateEngine(new FreemarkerTemplateEngine()); // mpg.setTemplateEngine(new FreemarkerTemplateEngine());
mpg.execute(); // mpg.execute();
} // }
//
public static void main(String[] args) { // public static void main(String[] args) {
//
DataSourceConfig dsc = new DataSourceConfig(); // DataSourceConfig dsc = new DataSourceConfig();
// dsc.setSchemaName("public"); //// dsc.setSchemaName("public");
dsc.setDriverName("com.mysql.cj.jdbc.Driver"); // dsc.setDriverName("com.mysql.cj.jdbc.Driver");
dsc.setUrl("jdbc:mysql://39.106.122.201:3308/dev_ln_scene?useUnicode=true&useSSL=false&characterEncoding=utf8&serverTimezone=CST"); // dsc.setUrl("jdbc:mysql://39.106.122.201:3308/dev_ln_scene?useUnicode=true&useSSL=false&characterEncoding=utf8&serverTimezone=CST");
dsc.setUsername("testmall"); // dsc.setUsername("testmall");
dsc.setPassword("zhengzai!mYT"); // dsc.setPassword("zhengzai!mYT");
//
String resourcePath = "/Users/hujiachen/Downloads/tmp"; // String resourcePath = "/Users/hujiachen/Downloads/tmp";
String directory = "com.liquidnet.service.kylin"; // String directory = "com.liquidnet.service.kylin";
// String[] dbTableArray = new String[]{"kylin_fields","kylin_field_status","kylin_field_relations"}; //// String[] dbTableArray = new String[]{"kylin_fields","kylin_field_status","kylin_field_relations"};
// String[] dbTableArray = new String[]{"kylin_performances","kylin_performance_status","kylin_performance_relations"}; //// String[] dbTableArray = new String[]{"kylin_performances","kylin_performance_status","kylin_performance_relations"};
// String[] dbTableArray = new String[]{"kylin_ticket_status","kylin_ticket_time_relation","kylin_ticket_times","kylin_ticket_relations","kylin_tickets"}; //// String[] dbTableArray = new String[]{"kylin_ticket_status","kylin_ticket_time_relation","kylin_ticket_times","kylin_ticket_relations","kylin_tickets"};
// String[] dbTableArray = new String[]{"kylin_road_shows"}; //// String[] dbTableArray = new String[]{"kylin_road_shows"};
// String[] dbTableArray = new String[]{"kylin_buy_notice"}; //// String[] dbTableArray = new String[]{"kylin_buy_notice"};
// String[] dbTableArray = new String[]{"kylin_order_tickets","kylin_order_ticket_relations","kylin_order_ticket_status","kylin_order_ticket_entities"}; //// String[] dbTableArray = new String[]{"kylin_order_tickets","kylin_order_ticket_relations","kylin_order_ticket_status","kylin_order_ticket_entities"};
// String[] dbTableArray = new String[]{"kylin_check_user","kylin_check_user_performances"}; //// String[] dbTableArray = new String[]{"kylin_check_user","kylin_check_user_performances"};
String[] dbTableArray = new String[]{"express_batches","express_logs","express_timelines","expresses"}; // String[] dbTableArray = new String[]{"express_batches","express_logs","express_timelines","expresses"};
//
doGenerator(resourcePath, dsc, directory, dbTableArray); // doGenerator(resourcePath, dsc, directory, dbTableArray);
} // }
} //}
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