添加代码生成器

This commit is contained in:
zykzhangyukang 2020-12-16 12:03:00 +08:00
parent aa78d89794
commit 7896f2ec23
11 changed files with 55 additions and 5 deletions

4
.gitignore vendored
View file

@ -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

View file

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 11 KiB

View file

Before

Width:  |  Height:  |  Size: 29 KiB

After

Width:  |  Height:  |  Size: 29 KiB

View file

Before

Width:  |  Height:  |  Size: 34 KiB

After

Width:  |  Height:  |  Size: 34 KiB

View file

Before

Width:  |  Height:  |  Size: 216 KiB

After

Width:  |  Height:  |  Size: 216 KiB

View file

@ -9,6 +9,7 @@
<module>xinguan-system</module>
<module>xinguan-business</module>
<module>xinguan-web</module>
<module>xinguan-generator</module>
</modules>
<parent>

View file

@ -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
View 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>

View file

@ -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("代码生成成功");
}
}