|
@@ -1,8 +1,10 @@
|
|
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|
|
import com.baomidou.mybatisplus.generator.FastAutoGenerator;
|
|
|
+import com.baomidou.mybatisplus.generator.config.OutputFile;
|
|
|
import org.junit.jupiter.api.Test;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
+import java.util.Collections;
|
|
|
import java.util.List;
|
|
|
|
|
|
public class AutoGenerate {
|
|
@@ -10,11 +12,11 @@ public class AutoGenerate {
|
|
|
|
|
|
@Test
|
|
|
public void generate() {
|
|
|
- String path ="H:\\project\\4dkankan-parent\\4dkankan-center-platform";
|
|
|
+ String path ="H:\\project\\4dkankan-parent\\test";
|
|
|
List<String> tables = new ArrayList<>();
|
|
|
tables.add("t_agent");
|
|
|
-
|
|
|
- FastAutoGenerator.create("jdbc:mysql://localhost:3306/4dkankan_center_application",
|
|
|
+ String moduleName ="test";
|
|
|
+ FastAutoGenerator.create("jdbc:mysql://localhost:3306/test",
|
|
|
"root","123456")
|
|
|
.globalConfig(builder -> {
|
|
|
builder.author("") //作者
|
|
@@ -26,14 +28,14 @@ public class AutoGenerate {
|
|
|
})
|
|
|
.packageConfig(builder -> {
|
|
|
builder.parent("com.fdkankan")
|
|
|
- .moduleName("test")
|
|
|
+ .moduleName(moduleName)
|
|
|
.entity("entity")
|
|
|
.service("service")
|
|
|
.serviceImpl("service.impl")
|
|
|
.controller("controller")
|
|
|
.mapper("mapper")
|
|
|
- .xml("mapper.xml");
|
|
|
- //.pathInfo(Collections.singletonMap(OutputFile.mapperXml,path+"\\src\\main\\resources\\mapper"));
|
|
|
+ .xml("test.mapper")
|
|
|
+ .pathInfo(Collections.singletonMap(OutputFile.mapperXml,path+"\\src\\main\\resources\\mapper\\"+moduleName));
|
|
|
})
|
|
|
.strategyConfig(builder -> {
|
|
|
builder.addInclude(tables)
|