Commit 231ffa43 authored by tianyiming's avatar tianyiming

tzs拆分服务根据表生成代码

parent 7ea33d57
...@@ -136,6 +136,11 @@ ...@@ -136,6 +136,11 @@
<artifactId>pagehelper</artifactId> <artifactId>pagehelper</artifactId>
<version>5.1.10</version> <version>5.1.10</version>
</dependency> </dependency>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<scope>runtime</scope>
</dependency>
</dependencies> </dependencies>
......
...@@ -27,28 +27,32 @@ public class MyBatisPlusCodeGeneratorTzs { ...@@ -27,28 +27,32 @@ public class MyBatisPlusCodeGeneratorTzs {
* 项目名称缩写 * 项目名称缩写
*/ */
static String projectShortName = "tzs"; static String projectShortName = "tzs";
/**
* 拆分服务名 可根据实际拆分项目进行修改
*/
static String ShortName = "ymt";
/** /**
* 项目api目录 * 项目api目录
*/ */
static String apiAddress = "/amos-boot-system-" + projectShortName + "/" + static String apiAddress = "/amos-boot-system-" + projectShortName + "/" + "amos-boot-module-ymt/" +
"amos-boot-module-" + projectShortName + "-api/"; "amos-boot-module-" + ShortName + "-api/";
/** /**
* 项目biz目录 * 项目biz目录
*/ */
static String bizAddress = "/amos-boot-system-" + projectShortName + "/" + static String bizAddress = "/amos-boot-system-" + projectShortName + "/" + "amos-boot-module-ymt/" +
"amos-boot-module-" + projectShortName + "-biz/"; "amos-boot-module-" + ShortName + "-biz/";
/** /**
* 项目api路径 * 项目api路径
*/ */
static String apiPath = apiAddress + "src/main/java/com/yeejoin/amos/boot/module/" + projectShortName + "/api"; static String apiPath = apiAddress + "src/main/java/com/yeejoin/amos/boot/module/" + ShortName + "/api";
/** /**
* 项目biz路径 * 项目biz路径
*/ */
static String bizPath = bizAddress + "src/main/java/com/yeejoin/amos/boot/module/" + projectShortName + "/biz"; static String bizPath = bizAddress + "src/main/java/com/yeejoin/amos/boot/module/" + ShortName + "/biz";
/** /**
* 接口及实体等代码生成路径 * 接口及实体等代码生成路径
...@@ -102,12 +106,12 @@ public class MyBatisPlusCodeGeneratorTzs { ...@@ -102,12 +106,12 @@ public class MyBatisPlusCodeGeneratorTzs {
gc.setActiveRecord(false); gc.setActiveRecord(false);
// 数据源配置 // 数据源配置
DataSourceConfig dsc = new DataSourceConfig(); DataSourceConfig dsc = new DataSourceConfig();
dsc.setUrl("jdbc:mysql://172.16.10.90:53306/tzs_amos_tzs_biz?serverTimezone=GMT%2B8"); dsc.setUrl("jdbc:postgresql://36.46.137.116:5432/tzs_amos_tzs_biz_init?&serverTimezone=GMT%2B8");
// dsc.setSchemaName("public"); dsc.setSchemaName("amos_tzs_biz");
// dsc.setDriverName("com.mysql.jdbc.Driver"); dsc.setDriverName("org.postgresql.Driver");
dsc.setDriverName("com.mysql.cj.jdbc.Driver"); // dsc.setDriverName("cn.com.vastbase.Driver");
dsc.setUsername("root"); dsc.setUsername("admin");
dsc.setPassword("Yeejoin@2020"); dsc.setPassword("Yeejoin@2023");
dsc.setTypeConvert(new ITypeConvert() { dsc.setTypeConvert(new ITypeConvert() {
@Override @Override
...@@ -129,7 +133,7 @@ public class MyBatisPlusCodeGeneratorTzs { ...@@ -129,7 +133,7 @@ public class MyBatisPlusCodeGeneratorTzs {
// 包配置 // 包配置
final PackageConfig pc = new PackageConfig(); final PackageConfig pc = new PackageConfig();
// 填写对应模块 // 填写对应模块
pc.setModuleName(projectShortName); pc.setModuleName(ShortName);
// 实体路径 // 实体路径
pc.setParent("com.yeejoin.amos.boot.module"); pc.setParent("com.yeejoin.amos.boot.module");
pc.setEntity("api.entity"); pc.setEntity("api.entity");
...@@ -204,7 +208,7 @@ public class MyBatisPlusCodeGeneratorTzs { ...@@ -204,7 +208,7 @@ public class MyBatisPlusCodeGeneratorTzs {
focList.add(new FileOutConfig(mapper) { focList.add(new FileOutConfig(mapper) {
@Override @Override
public String outputFile(TableInfo tableInfo) { public String outputFile(TableInfo tableInfo) {
String filePath = interfaceCodeOutPath String filePath = interfaceCodeOutPath
+ "/mapper/" + tableInfo.getEntityName() + "Mapper" + StringPool.DOT_JAVA; + "/mapper/" + tableInfo.getEntityName() + "Mapper" + StringPool.DOT_JAVA;
System.out.println("mapper:"+filePath); System.out.println("mapper:"+filePath);
return filePath; return filePath;
...@@ -214,17 +218,17 @@ public class MyBatisPlusCodeGeneratorTzs { ...@@ -214,17 +218,17 @@ public class MyBatisPlusCodeGeneratorTzs {
focList.add(new FileOutConfig(service) { focList.add(new FileOutConfig(service) {
@Override @Override
public String outputFile(TableInfo tableInfo) { public String outputFile(TableInfo tableInfo) {
String filePath = interfaceCodeOutPath String filePath = interfaceCodeOutPath
+ "/service/" + tableInfo.getServiceName() + StringPool.DOT_JAVA; + "/service/" + tableInfo.getServiceName() + StringPool.DOT_JAVA;
System.out.println("service:"+filePath); System.out.println("service:"+filePath);
return filePath; return filePath;
} }
}); });
focList.add(new FileOutConfig(serviceImpl) { focList.add(new FileOutConfig(serviceImpl) {
@Override @Override
public String outputFile(TableInfo tableInfo) { public String outputFile(TableInfo tableInfo) {
String filePath = controllerCodeOutPath String filePath = controllerCodeOutPath
+ "/service/impl/" + tableInfo.getServiceImplName() + StringPool.DOT_JAVA; + "/service/impl/" + tableInfo.getServiceImplName() + StringPool.DOT_JAVA;
System.out.println("service/impl:"+filePath); System.out.println("service/impl:"+filePath);
return filePath; return filePath;
......
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