Commit 231ffa43 authored by tianyiming's avatar tianyiming

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

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