|
|
@@ -1,14 +1,13 @@
|
|
1
|
1
|
package com.zzsmart.qomo.kn.cost.manage;
|
|
2
|
2
|
|
|
3
|
3
|
import com.baomidou.mybatisplus.annotation.IdType;
|
|
|
4
|
+import com.baomidou.mybatisplus.generator.FastAutoGenerator;
|
|
4
|
5
|
import com.baomidou.mybatisplus.generator.config.OutputFile;
|
|
5
|
|
-import com.baomidou.mybatisplus.generator.config.rules.DbColumnType;
|
|
6
|
6
|
import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy;
|
|
7
|
7
|
import com.baomidou.mybatisplus.generator.engine.FreemarkerTemplateEngine;
|
|
8
|
8
|
import org.junit.Test;
|
|
9
|
9
|
import org.springframework.boot.test.context.SpringBootTest;
|
|
10
|
|
-import com.baomidou.mybatisplus.generator.FastAutoGenerator;
|
|
11
|
|
-import java.sql.Types;
|
|
|
10
|
+
|
|
12
|
11
|
import java.util.Collections;
|
|
13
|
12
|
|
|
14
|
13
|
@SpringBootTest
|
|
|
@@ -16,14 +15,14 @@ public class ApplicationTests {
|
|
16
|
15
|
|
|
17
|
16
|
/**
|
|
18
|
17
|
* 根据表名生成相应结构代码
|
|
19
|
|
- * @param databaseName 数据库名
|
|
20
|
|
- * @param tableName 表名
|
|
|
18
|
+// * @param databaseName 数据库名
|
|
|
19
|
+// * @param tableName 表名
|
|
21
|
20
|
*/
|
|
22
|
21
|
@Test
|
|
23
|
|
- public static void Generation(String databaseName,String... tableName){
|
|
24
|
|
- FastAutoGenerator.create("jdbc:mysql://localhost:3306/"+databaseName+"?&useSSL=true&useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai","root","wsndqd857857")
|
|
|
22
|
+ public void Generation(){
|
|
|
23
|
+ FastAutoGenerator.create("jdbc:mysql://121.40.189.20:3306/"+"costmanage"+"?&useSSL=true&useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai","root","YMzc157#")
|
|
25
|
24
|
.globalConfig(builder -> {
|
|
26
|
|
- builder.author("罗添煦")
|
|
|
25
|
+ builder.author(" ")
|
|
27
|
26
|
//启用swagger
|
|
28
|
27
|
//.enableSwagger()
|
|
29
|
28
|
//指定输出目录
|
|
|
@@ -31,19 +30,17 @@ public class ApplicationTests {
|
|
31
|
30
|
})
|
|
32
|
31
|
.packageConfig(builder -> {
|
|
33
|
32
|
builder.entity("entity")//实体类包名
|
|
34
|
|
- .parent("com.ltx.mpcode")//父包名。如果为空,将下面子包名必须写全部, 否则就只需写子包名
|
|
|
33
|
+ .parent("com.zzsmart.qomo.kn.cost.manage")//父包名。如果为空,将下面子包名必须写全部, 否则就只需写子包名
|
|
35
|
34
|
.controller("controller")//控制层包名
|
|
36
|
|
- .mapper("dao")//mapper层包名
|
|
|
35
|
+ .mapper("mapper")//mapper层包名
|
|
37
|
36
|
//.other("dto")//生成dto目录 可不用
|
|
38
|
37
|
.service("service")//service层包名
|
|
39
|
38
|
.serviceImpl("service.impl")//service实现类包名
|
|
40
|
39
|
//自定义mapper.xml文件输出目录
|
|
41
|
|
- .pathInfo(Collections.singletonMap(OutputFile.mapperXml,System.getProperty("user.dir")+"/src/main/resources/mapper"));
|
|
|
40
|
+ .pathInfo(Collections.singletonMap(OutputFile.mapperXml,System.getProperty("user.dir")+"/src/main/java/com/zzsmart/qomo/kn/cost/manage/mapper/xml"));
|
|
42
|
41
|
})
|
|
43
|
42
|
.strategyConfig(builder -> {
|
|
44
|
|
- //设置要生成的表名
|
|
45
|
|
- builder.addInclude(tableName)
|
|
46
|
|
- .addInclude("cp_order_history")// 设置需要生成的表名
|
|
|
43
|
+ builder.addInclude("7525_replacement_cost")// todo 设置需要生成的表名
|
|
47
|
44
|
//.addTablePrefix("sys_")//设置表前缀过滤
|
|
48
|
45
|
.entityBuilder()
|
|
49
|
46
|
.enableLombok()
|
|
|
@@ -57,12 +54,12 @@ public class ApplicationTests {
|
|
57
|
54
|
.enableBaseResultMap()//启用xml文件中的BaseResultMap 生成
|
|
58
|
55
|
.enableBaseColumnList()//启用xml文件中的BaseColumnList
|
|
59
|
56
|
.formatMapperFileName("%sMapper")//格式化Dao类名称
|
|
60
|
|
- .formatXmlFileName("%sMapper")//格式化xml文件名称
|
|
61
|
|
- .serviceBuilder()
|
|
62
|
|
- .formatServiceFileName("%sService")//格式化 service 接口文件名称
|
|
63
|
|
- .formatServiceImplFileName("%sServiceImpl")//格式化 service 接口文件名称
|
|
64
|
|
- .controllerBuilder()
|
|
65
|
|
- .enableRestStyle();
|
|
|
57
|
+ .formatXmlFileName("%sMapper");//格式化xml文件名称
|
|
|
58
|
+// .serviceBuilder()
|
|
|
59
|
+// .formatServiceFileName("%sService")//格式化 service 接口文件名称
|
|
|
60
|
+// .formatServiceImplFileName("%sServiceImpl")//格式化 service 接口文件名称
|
|
|
61
|
+// .controllerBuilder()
|
|
|
62
|
+// .enableRestStyle();
|
|
66
|
63
|
})
|
|
67
|
64
|
// 使用Freemarker引擎模板,默认的是Velocity引擎模板
|
|
68
|
65
|
.templateEngine(new FreemarkerTemplateEngine())
|