Skip to content

Commit eee1886

Browse files
author
Washmore
committed
Merge branch 'release/v1.0.4' into develop
2 parents 0631c96 + 87bc640 commit eee1886

File tree

5 files changed

+22
-41
lines changed

5 files changed

+22
-41
lines changed

autocode.core/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<artifactId>autocode</artifactId>
77
<groupId>tech.washmore</groupId>
8-
<version>0.0.1-SNAPSHOT</version>
8+
<version>1.0.4-RELEASE</version>
99
</parent>
1010
<modelVersion>4.0.0</modelVersion>
1111
<artifactId>autocode.core</artifactId>

autocode.core/src/main/java/tech/washmore/autocode/core/generator/mysql/MysqlAbstractServiceClassGenerator.java

+11-30
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package tech.washmore.autocode.core.generator.mysql;
22

33
import tech.washmore.autocode.core.config.ConfigManager;
4+
import tech.washmore.autocode.core.generator.base.AutoCodeFileWriter;
45
import tech.washmore.autocode.model.Constants;
56
import tech.washmore.autocode.model.config.*;
67
import tech.washmore.autocode.model.enums.DataFileMethod;
@@ -48,17 +49,6 @@ private void generateServiceExtends(TableModel tm) throws IOException {
4849
Doc doc = config.getDoc();
4950
Project project = config.getProject();
5051

51-
File dic = new File(project.getPath() + Constants.pathSplitor + project.getJavaRoot() + Constants.pathSplitor + service.getExtendsPackagePath());
52-
if (!dic.exists()) {
53-
dic.mkdirs();
54-
}
55-
56-
File file = new File(dic, tm.getClsName() + service.getSuffix() + ".java");
57-
if (file.exists()) {
58-
return;
59-
}
60-
file.createNewFile();
61-
6252
StringBuffer sb = new StringBuffer("");
6353
sb.append("package ").append(service.getExtendsPackageName()).append(";").append(System.lineSeparator()).append(System.lineSeparator());
6454
sb.append("import org.springframework.stereotype.Service;").append(System.lineSeparator());
@@ -78,11 +68,11 @@ private void generateServiceExtends(TableModel tm) throws IOException {
7868
.append(System.lineSeparator());
7969
sb.append("}");
8070

81-
OutputStream ops = new FileOutputStream(file);
82-
ops.write(sb.toString().getBytes());
83-
ops.flush();
84-
ops.close();
85-
System.out.println("\t输出文件:" + file.getPath().replace(new File(config.getProject().getPath()).getPath(), ""));
71+
AutoCodeFileWriter.writeStringToFile(
72+
project.getPath() + Constants.pathSplitor + project.getJavaRoot()
73+
+ Constants.pathSplitor + service.getExtendsPackagePath(),
74+
tm.getClsName() + service.getSuffix() + ".java", sb.toString(), false
75+
);
8676
}
8777

8878
private void generateService(TableModel tm) throws IOException {
@@ -169,21 +159,12 @@ private void generateService(TableModel tm) throws IOException {
169159

170160
insertDependencies(sb, tm);
171161

172-
File dic = new File(project.getPath() + Constants.pathSplitor + project.getJavaRoot() + Constants.pathSplitor + service.getBasePackagePath());
173-
if (!dic.exists()) {
174-
dic.mkdirs();
175-
}
162+
AutoCodeFileWriter.writeStringToFile(
163+
project.getPath() + Constants.pathSplitor + project.getJavaRoot()
164+
+ Constants.pathSplitor + service.getBasePackagePath(),
165+
tm.getClsName() + service.getBaseSuffix() + ".java", sb.toString(), true
166+
);
176167

177-
File file = new File(dic, tm.getClsName() + service.getBaseSuffix() + ".java");
178-
if (file.exists()) {
179-
file.delete();
180-
}
181-
file.createNewFile();
182-
OutputStream ops = new FileOutputStream(file);
183-
ops.write(sb.toString().getBytes());
184-
ops.flush();
185-
ops.close();
186-
System.out.println("\t输出文件:" + file.getPath().replace(new File(config.getProject().getPath()).getPath(), ""));
187168
}
188169

189170

autocode.test/pom.xml

+2-7
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<artifactId>autocode</artifactId>
77
<groupId>tech.washmore</groupId>
8-
<version>0.0.1-SNAPSHOT</version>
8+
<version>1.0.4-RELEASE</version>
99
</parent>
1010
<modelVersion>4.0.0</modelVersion>
1111

@@ -18,11 +18,6 @@
1818
<artifactId>mybatis-spring-boot-starter</artifactId>
1919
<version>1.3.1</version>
2020
</dependency>
21-
<dependency>
22-
<groupId>tech.washmore</groupId>
23-
<version>0.0.1-SNAPSHOT</version>
24-
<artifactId>autocode.core</artifactId>
25-
</dependency>
2621
<dependency>
2722
<groupId>org.springframework.boot</groupId>
2823
<artifactId>spring-boot-starter-test</artifactId>
@@ -74,7 +69,7 @@
7469
<plugins>
7570
<plugin>
7671
<groupId>tech.washmore</groupId>
77-
<version>0.0.1-SNAPSHOT</version>
72+
<version>1.0.4-RELEASE</version>
7873
<artifactId>maven-autocode-plugin</artifactId>
7974
<configuration>
8075
<configLocation>/Users/chenyuqing/IdeaProjects/AutoCode/autocode.test/config.json</configLocation>

maven-autocode-plugin/pom.xml

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<parent>
44
<artifactId>autocode</artifactId>
55
<groupId>tech.washmore</groupId>
6-
<version>0.0.1-SNAPSHOT</version>
6+
<version>1.0.4-RELEASE</version>
77
</parent>
88
<modelVersion>4.0.0</modelVersion>
99
<artifactId>maven-autocode-plugin</artifactId>
@@ -38,7 +38,7 @@
3838
<dependency>
3939
<groupId>tech.washmore</groupId>
4040
<artifactId>autocode.core</artifactId>
41-
<version>0.0.1-SNAPSHOT</version>
41+
<version>1.0.4-RELEASE</version>
4242
</dependency>
4343
<dependency>
4444
<groupId>org.apache.maven</groupId>

pom.xml

+6-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<groupId>tech.washmore</groupId>
55
<artifactId>autocode</artifactId>
66
<packaging>pom</packaging>
7-
<version>0.0.1-SNAPSHOT</version>
7+
<version>1.0.4-RELEASE</version>
88
<modules>
99
<module>autocode.core</module>
1010
<module>autocode.test</module>
@@ -28,6 +28,11 @@
2828
<url>http://maven.washmore.tech/nexus/content/repositories/snapshots/</url>
2929
<uniqueVersion>false</uniqueVersion>
3030
</snapshotRepository>
31+
<repository>
32+
<id>deploymentRepo</id>
33+
<name>washmore_release</name>
34+
<url>http://maven.washmore.tech/nexus/content/repositories/releases/</url>
35+
</repository>
3136
</distributionManagement>
3237
<pluginRepositories>
3338
<pluginRepository>

0 commit comments

Comments
 (0)