添加代码生成器
4
.gitignore
vendored
|
@ -1,7 +1,9 @@
|
|||
xinguan-vue/node_modules/
|
||||
xinguan-vue/dist/
|
||||
*.iml
|
||||
.idea
|
||||
*.iws
|
||||
*.iml
|
||||
*.ipr
|
||||
xinguan-web/src/main/resources/3828034_www.zykhome.club.pfx
|
||||
xinguan-web/src/main/resources/pfx-password.txt
|
||||
xinguan-api.iml
|
||||
|
|
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
Before Width: | Height: | Size: 29 KiB After Width: | Height: | Size: 29 KiB |
Before Width: | Height: | Size: 34 KiB After Width: | Height: | Size: 34 KiB |
Before Width: | Height: | Size: 216 KiB After Width: | Height: | Size: 216 KiB |
1
pom.xml
|
@ -9,6 +9,7 @@
|
|||
<module>xinguan-system</module>
|
||||
<module>xinguan-business</module>
|
||||
<module>xinguan-web</module>
|
||||
<module>xinguan-generator</module>
|
||||
</modules>
|
||||
|
||||
<parent>
|
||||
|
|
|
@ -43,10 +43,6 @@
|
|||
<groupId>org.mybatis.spring.boot</groupId>
|
||||
<artifactId>mybatis-spring-boot-starter</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.mybatis.generator</groupId>
|
||||
<artifactId>mybatis-generator-core</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
|
|
21
xinguan-generator/pom.xml
Normal file
|
@ -0,0 +1,21 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<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>goods</artifactId>
|
||||
<groupId>com.coderman</groupId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>xinguan-generator</artifactId>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.mybatis.generator</groupId>
|
||||
<artifactId>mybatis-generator-core</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
|
@ -0,0 +1,30 @@
|
|||
package com.coderman.generator;
|
||||
|
||||
import org.mybatis.generator.api.MyBatisGenerator;
|
||||
import org.mybatis.generator.config.Configuration;
|
||||
import org.mybatis.generator.config.xml.ConfigurationParser;
|
||||
import org.mybatis.generator.internal.DefaultShellCallback;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author zhangyukang
|
||||
* @Date 2020/7/6 11:13
|
||||
* @Version 1.0
|
||||
**/
|
||||
public class MybatisGenerator {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
List<String> warnings = new ArrayList<String>();
|
||||
final boolean overwrite = true;
|
||||
InputStream resourceAsStream = MybatisGenerator.class.getResourceAsStream("/mybatis-generator.xml");
|
||||
ConfigurationParser cp = new ConfigurationParser(warnings);
|
||||
Configuration config = cp.parseConfiguration(resourceAsStream);
|
||||
DefaultShellCallback callback = new DefaultShellCallback(overwrite);
|
||||
MyBatisGenerator myBatisGenerator = new MyBatisGenerator(config, callback, warnings);
|
||||
myBatisGenerator.generate(null);
|
||||
System.out.println("代码生成成功");
|
||||
}
|
||||
}
|