-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1,688 changed files
with
1,580 additions
and
2,567 deletions.
There are no files selected for viewing
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
90 changes: 45 additions & 45 deletions
90
mybatis-generate/pom.xml → 10.MyBatis/mybatis-generate/pom.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,45 +1,45 @@ | ||
<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"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<groupId>cn.bravedawn</groupId> | ||
<artifactId>mybatis-generate</artifactId> | ||
<version>1.0-SNAPSHOT</version> | ||
<packaging>jar</packaging> | ||
|
||
<name>mybatis-generate</name> | ||
<url>http://maven.apache.org</url> | ||
|
||
<properties> | ||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
</properties> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>org.mybatis.generator</groupId> | ||
<artifactId>mybatis-generator-core</artifactId> | ||
<version>1.3.7</version> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>mysql</groupId> | ||
<artifactId>mysql-connector-java</artifactId> | ||
<version>8.0.21</version> | ||
</dependency> | ||
</dependencies> | ||
|
||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-compiler-plugin</artifactId> | ||
<version>3.10.1</version> | ||
<configuration> | ||
<source>11</source> | ||
<target>11</target> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</project> | ||
<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"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<groupId>cn.bravedawn</groupId> | ||
<artifactId>mybatis-generate</artifactId> | ||
<version>1.0-SNAPSHOT</version> | ||
<packaging>jar</packaging> | ||
|
||
<name>mybatis-generate</name> | ||
<url>http://maven.apache.org</url> | ||
|
||
<properties> | ||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
</properties> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>org.mybatis.generator</groupId> | ||
<artifactId>mybatis-generator-core</artifactId> | ||
<version>1.3.7</version> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>mysql</groupId> | ||
<artifactId>mysql-connector-java</artifactId> | ||
<version>8.0.21</version> | ||
</dependency> | ||
</dependencies> | ||
|
||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-compiler-plugin</artifactId> | ||
<version>3.10.1</version> | ||
<configuration> | ||
<source>11</source> | ||
<target>11</target> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</project> |
84 changes: 42 additions & 42 deletions
84
...n/java/cn/bravedawn/CommentGenerator.java → ...n/java/cn/bravedawn/CommentGenerator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,42 @@ | ||
package cn.bravedawn; | ||
|
||
import org.mybatis.generator.api.IntrospectedColumn; | ||
import org.mybatis.generator.api.IntrospectedTable; | ||
import org.mybatis.generator.api.dom.java.Field; | ||
import org.mybatis.generator.internal.DefaultCommentGenerator; | ||
import org.mybatis.generator.internal.util.StringUtility; | ||
|
||
import java.util.Properties; | ||
|
||
public class CommentGenerator extends DefaultCommentGenerator { | ||
|
||
private boolean addRemarkComments = false; | ||
|
||
/** | ||
* 设置用户配置的参数 | ||
*/ | ||
@Override | ||
public void addConfigurationProperties(Properties properties) { | ||
super.addConfigurationProperties(properties); | ||
this.addRemarkComments = StringUtility.isTrue(properties.getProperty("addRemarkComments")); | ||
} | ||
|
||
/** | ||
* 给字段添加注释 | ||
*/ | ||
@Override | ||
public void addFieldComment(Field field, IntrospectedTable introspectedTable, | ||
IntrospectedColumn introspectedColumn) { | ||
String remarks = introspectedColumn.getRemarks(); | ||
// 根据参数和备注信息判断是否添加备注信息 | ||
if(addRemarkComments && StringUtility.stringHasValue(remarks)){ | ||
|
||
StringBuilder sb = new StringBuilder(); | ||
field.addJavaDocLine("/**"); | ||
sb.append(" * "); | ||
sb.append(remarks); | ||
field.addJavaDocLine(sb.toString().replace("\n", " ")); | ||
field.addJavaDocLine(" */"); | ||
} | ||
} | ||
} | ||
package cn.bravedawn; | ||
|
||
import org.mybatis.generator.api.IntrospectedColumn; | ||
import org.mybatis.generator.api.IntrospectedTable; | ||
import org.mybatis.generator.api.dom.java.Field; | ||
import org.mybatis.generator.internal.DefaultCommentGenerator; | ||
import org.mybatis.generator.internal.util.StringUtility; | ||
|
||
import java.util.Properties; | ||
|
||
public class CommentGenerator extends DefaultCommentGenerator { | ||
|
||
private boolean addRemarkComments = false; | ||
|
||
/** | ||
* 设置用户配置的参数 | ||
*/ | ||
@Override | ||
public void addConfigurationProperties(Properties properties) { | ||
super.addConfigurationProperties(properties); | ||
this.addRemarkComments = StringUtility.isTrue(properties.getProperty("addRemarkComments")); | ||
} | ||
|
||
/** | ||
* 给字段添加注释 | ||
*/ | ||
@Override | ||
public void addFieldComment(Field field, IntrospectedTable introspectedTable, | ||
IntrospectedColumn introspectedColumn) { | ||
String remarks = introspectedColumn.getRemarks(); | ||
// 根据参数和备注信息判断是否添加备注信息 | ||
if(addRemarkComments && StringUtility.stringHasValue(remarks)){ | ||
|
||
StringBuilder sb = new StringBuilder(); | ||
field.addJavaDocLine("/**"); | ||
sb.append(" * "); | ||
sb.append(remarks); | ||
field.addJavaDocLine(sb.toString().replace("\n", " ")); | ||
field.addJavaDocLine(" */"); | ||
} | ||
} | ||
} |
70 changes: 35 additions & 35 deletions
70
...src/main/java/cn/bravedawn/Generator.java → ...src/main/java/cn/bravedawn/Generator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,35 @@ | ||
package cn.bravedawn; | ||
|
||
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; | ||
|
||
public class Generator { | ||
|
||
public static void main(String[] args) throws Exception { | ||
//MBG 执行过程中的警告信息 | ||
List<String> warnings = new ArrayList<String>(); | ||
//当生成的代码重复时,覆盖原代码 | ||
boolean overwrite = true; | ||
//读取我们的 MBG 配置文件 | ||
InputStream is = Generator.class.getResourceAsStream("/generatorConfig.xml"); | ||
ConfigurationParser cp = new ConfigurationParser(warnings); | ||
Configuration config = cp.parseConfiguration(is); | ||
is.close(); | ||
|
||
DefaultShellCallback callback = new DefaultShellCallback(overwrite); | ||
//创建 MBG | ||
MyBatisGenerator myBatisGenerator = new MyBatisGenerator(config, callback, warnings); | ||
//执行生成代码 | ||
myBatisGenerator.generate(null); | ||
//输出警告信息 | ||
for (String warning : warnings) { | ||
System.out.println(warning); | ||
} | ||
} | ||
} | ||
package cn.bravedawn; | ||
|
||
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; | ||
|
||
public class Generator { | ||
|
||
public static void main(String[] args) throws Exception { | ||
//MBG 执行过程中的警告信息 | ||
List<String> warnings = new ArrayList<String>(); | ||
//当生成的代码重复时,覆盖原代码 | ||
boolean overwrite = true; | ||
//读取我们的 MBG 配置文件 | ||
InputStream is = Generator.class.getResourceAsStream("/generatorConfig.xml"); | ||
ConfigurationParser cp = new ConfigurationParser(warnings); | ||
Configuration config = cp.parseConfiguration(is); | ||
is.close(); | ||
|
||
DefaultShellCallback callback = new DefaultShellCallback(overwrite); | ||
//创建 MBG | ||
MyBatisGenerator myBatisGenerator = new MyBatisGenerator(config, callback, warnings); | ||
//执行生成代码 | ||
myBatisGenerator.generate(null); | ||
//输出警告信息 | ||
for (String warning : warnings) { | ||
System.out.println(warning); | ||
} | ||
} | ||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
20 changes: 10 additions & 10 deletions
20
...e/src/main/resources/generator.properties → ...e/src/main/resources/generator.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
jdbc.driverClass=com.mysql.cj.jdbc.Driver | ||
jdbc.connectionURL=jdbc:mysql://192.168.13.128:3306/jasper?serverTimezone=Asia/Shanghai | ||
jdbc.userId=root | ||
jdbc.password=fx1212 | ||
|
||
# java | ||
project=src/main/java | ||
|
||
# resource | ||
resources=src/main/resources | ||
jdbc.driverClass=com.mysql.cj.jdbc.Driver | ||
jdbc.connectionURL=jdbc:mysql://192.168.13.128:3306/jasper?serverTimezone=Asia/Shanghai | ||
jdbc.userId=root | ||
jdbc.password=fx1212 | ||
|
||
# java | ||
project=src/main/java | ||
|
||
# resource | ||
resources=src/main/resources |
Oops, something went wrong.