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

Commit 7401d585 authored by anjiabin's avatar anjiabin

提交liquidnet-bus-qpi

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