diff --git a/mybatis-flex-codegen/src/main/java/com/mybatisflex/codegen/config/ControllerConfig.java b/mybatis-flex-codegen/src/main/java/com/mybatisflex/codegen/config/ControllerConfig.java index 2dd47e76..3cd804f7 100644 --- a/mybatis-flex-codegen/src/main/java/com/mybatisflex/codegen/config/ControllerConfig.java +++ b/mybatis-flex-codegen/src/main/java/com/mybatisflex/codegen/config/ControllerConfig.java @@ -1,17 +1,17 @@ -/** - * Copyright (c) 2022-2023, Mybatis-Flex (fuhai999@gmail.com). - *
- * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - *
- * http://www.apache.org/licenses/LICENSE-2.0 - *
- * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. +/* + * Copyright (c) 2022-2023, Mybatis-Flex (fuhai999@gmail.com). + *
+ * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + *
+ * http://www.apache.org/licenses/LICENSE-2.0 + *
+ * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package com.mybatisflex.codegen.config; @@ -39,6 +39,11 @@ public class ControllerConfig { */ private Class> supperClass; + /** + * 是否覆盖之前生成的文件。 + */ + private boolean overwriteEnable; + /** * 生成 REST 风格的 Controller。 */ @@ -79,6 +84,15 @@ public class ControllerConfig { return this; } + public boolean isOverwriteEnable() { + return overwriteEnable; + } + + public ControllerConfig setOverwriteEnable(boolean overwriteEnable) { + this.overwriteEnable = overwriteEnable; + return this; + } + public boolean isRestStyle() { return restStyle; } diff --git a/mybatis-flex-codegen/src/main/java/com/mybatisflex/codegen/config/EntityConfig.java b/mybatis-flex-codegen/src/main/java/com/mybatisflex/codegen/config/EntityConfig.java index 02e3ce1f..fbf2d8bb 100644 --- a/mybatis-flex-codegen/src/main/java/com/mybatisflex/codegen/config/EntityConfig.java +++ b/mybatis-flex-codegen/src/main/java/com/mybatisflex/codegen/config/EntityConfig.java @@ -1,17 +1,17 @@ -/** - * Copyright (c) 2022-2023, Mybatis-Flex (fuhai999@gmail.com). - *
- * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - *
- * http://www.apache.org/licenses/LICENSE-2.0 - *
- * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. +/* + * Copyright (c) 2022-2023, Mybatis-Flex (fuhai999@gmail.com). + *
+ * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + *
+ * http://www.apache.org/licenses/LICENSE-2.0 + *
+ * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package com.mybatisflex.codegen.config; @@ -41,6 +41,11 @@ public class EntityConfig { */ private Class> supperClass; + /** + * 是否覆盖之前生成的文件。 + */ + private boolean overwriteEnable; + /** * Entity 默认实现的接口。 */ @@ -78,6 +83,15 @@ public class EntityConfig { return this; } + public boolean isOverwriteEnable() { + return overwriteEnable; + } + + public EntityConfig setOverwriteEnable(boolean overwriteEnable) { + this.overwriteEnable = overwriteEnable; + return this; + } + public Class>[] getImplInterfaces() { return implInterfaces; } diff --git a/mybatis-flex-codegen/src/main/java/com/mybatisflex/codegen/config/MapperConfig.java b/mybatis-flex-codegen/src/main/java/com/mybatisflex/codegen/config/MapperConfig.java index 2aed21b8..86a3f9c5 100644 --- a/mybatis-flex-codegen/src/main/java/com/mybatisflex/codegen/config/MapperConfig.java +++ b/mybatis-flex-codegen/src/main/java/com/mybatisflex/codegen/config/MapperConfig.java @@ -1,17 +1,17 @@ -/** - * Copyright (c) 2022-2023, Mybatis-Flex (fuhai999@gmail.com). - *
- * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - *
- * http://www.apache.org/licenses/LICENSE-2.0 - *
- * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. +/* + * Copyright (c) 2022-2023, Mybatis-Flex (fuhai999@gmail.com). + *
+ * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + *
+ * http://www.apache.org/licenses/LICENSE-2.0 + *
+ * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package com.mybatisflex.codegen.config; @@ -41,6 +41,11 @@ public class MapperConfig { */ private Class> supperClass = BaseMapper.class; + /** + * 是否覆盖之前生成的文件。 + */ + private boolean overwriteEnable; + public String buildSuperClassImport() { return supperClass.getName(); } @@ -76,4 +81,13 @@ public class MapperConfig { return this; } + public boolean isOverwriteEnable() { + return overwriteEnable; + } + + public MapperConfig setOverwriteEnable(boolean overwriteEnable) { + this.overwriteEnable = overwriteEnable; + return this; + } + } \ No newline at end of file diff --git a/mybatis-flex-codegen/src/main/java/com/mybatisflex/codegen/config/MapperXmlConfig.java b/mybatis-flex-codegen/src/main/java/com/mybatisflex/codegen/config/MapperXmlConfig.java index 68acc26c..4b27ee0d 100644 --- a/mybatis-flex-codegen/src/main/java/com/mybatisflex/codegen/config/MapperXmlConfig.java +++ b/mybatis-flex-codegen/src/main/java/com/mybatisflex/codegen/config/MapperXmlConfig.java @@ -34,6 +34,11 @@ public class MapperXmlConfig { */ private String fileSuffix = "Mapper"; + /** + * 是否覆盖之前生成的文件。 + */ + private boolean overwriteEnable; + public String getFilePrefix() { return filePrefix; } @@ -52,4 +57,13 @@ public class MapperXmlConfig { return this; } + public boolean isOverwriteEnable() { + return overwriteEnable; + } + + public MapperXmlConfig setOverwriteEnable(boolean overwriteEnable) { + this.overwriteEnable = overwriteEnable; + return this; + } + } \ No newline at end of file diff --git a/mybatis-flex-codegen/src/main/java/com/mybatisflex/codegen/config/ServiceConfig.java b/mybatis-flex-codegen/src/main/java/com/mybatisflex/codegen/config/ServiceConfig.java index c3084b0f..174db0c9 100644 --- a/mybatis-flex-codegen/src/main/java/com/mybatisflex/codegen/config/ServiceConfig.java +++ b/mybatis-flex-codegen/src/main/java/com/mybatisflex/codegen/config/ServiceConfig.java @@ -1,17 +1,17 @@ -/** - * Copyright (c) 2022-2023, Mybatis-Flex (fuhai999@gmail.com). - *
- * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - *
- * http://www.apache.org/licenses/LICENSE-2.0 - *
- * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. +/* + * Copyright (c) 2022-2023, Mybatis-Flex (fuhai999@gmail.com). + *
+ * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + *
+ * http://www.apache.org/licenses/LICENSE-2.0 + *
+ * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package com.mybatisflex.codegen.config; @@ -41,6 +41,11 @@ public class ServiceConfig { */ private Class> supperClass = IService.class; + /** + * 是否覆盖之前生成的文件。 + */ + private boolean overwriteEnable; + public String buildSuperClassImport() { return supperClass.getName(); } @@ -76,4 +81,13 @@ public class ServiceConfig { return this; } + public boolean isOverwriteEnable() { + return overwriteEnable; + } + + public ServiceConfig setOverwriteEnable(boolean overwriteEnable) { + this.overwriteEnable = overwriteEnable; + return this; + } + } \ No newline at end of file diff --git a/mybatis-flex-codegen/src/main/java/com/mybatisflex/codegen/config/ServiceImplConfig.java b/mybatis-flex-codegen/src/main/java/com/mybatisflex/codegen/config/ServiceImplConfig.java index 972d77c4..274c2f90 100644 --- a/mybatis-flex-codegen/src/main/java/com/mybatisflex/codegen/config/ServiceImplConfig.java +++ b/mybatis-flex-codegen/src/main/java/com/mybatisflex/codegen/config/ServiceImplConfig.java @@ -1,17 +1,17 @@ -/** - * Copyright (c) 2022-2023, Mybatis-Flex (fuhai999@gmail.com). - *
- * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - *
- * http://www.apache.org/licenses/LICENSE-2.0 - *
- * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. +/* + * Copyright (c) 2022-2023, Mybatis-Flex (fuhai999@gmail.com). + *
+ * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + *
+ * http://www.apache.org/licenses/LICENSE-2.0 + *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
package com.mybatisflex.codegen.config;
@@ -41,6 +41,11 @@ public class ServiceImplConfig {
*/
private Class> supperClass = ServiceImpl.class;
+ /**
+ * 是否覆盖之前生成的文件。
+ */
+ private boolean overwriteEnable;
+
public String buildSuperClassImport() {
return supperClass.getName();
}
@@ -76,4 +81,13 @@ public class ServiceImplConfig {
return this;
}
+ public boolean isOverwriteEnable() {
+ return overwriteEnable;
+ }
+
+ public ServiceImplConfig setOverwriteEnable(boolean overwriteEnable) {
+ this.overwriteEnable = overwriteEnable;
+ return this;
+ }
+
}
\ No newline at end of file
diff --git a/mybatis-flex-codegen/src/main/java/com/mybatisflex/codegen/config/StrategyConfig.java b/mybatis-flex-codegen/src/main/java/com/mybatisflex/codegen/config/StrategyConfig.java
index 974dfdca..4ee35977 100644
--- a/mybatis-flex-codegen/src/main/java/com/mybatisflex/codegen/config/StrategyConfig.java
+++ b/mybatis-flex-codegen/src/main/java/com/mybatisflex/codegen/config/StrategyConfig.java
@@ -16,9 +16,6 @@
package com.mybatisflex.codegen.config;
-import com.mybatisflex.codegen.template.ITemplate;
-import com.mybatisflex.codegen.template.impl.EnjoyTemplate;
-
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
@@ -33,11 +30,6 @@ import java.util.Set;
@SuppressWarnings("unused")
public class StrategyConfig {
- /**
- * 使用哪个模板引擎来生成代码。
- */
- protected ITemplate templateEngine;
-
/**
* 数据库表前缀,多个前缀用英文逗号(,) 隔开。
*/
@@ -58,11 +50,6 @@ public class StrategyConfig {
*/
private boolean generateForView;
- /**
- * 是否覆盖之前生成的文件。
- */
- private boolean overwriteEnable;
-
/**
* 单独为某张表添加独立的配置。
*/
@@ -185,18 +172,6 @@ public class StrategyConfig {
return false;
}
- public ITemplate getTemplateEngine() {
- if (templateEngine == null) {
- templateEngine = new EnjoyTemplate();
- }
- return templateEngine;
- }
-
- public StrategyConfig setTemplateEngine(ITemplate templateEngine) {
- this.templateEngine = templateEngine;
- return this;
- }
-
public String getTablePrefix() {
return tablePrefix;
}
@@ -233,15 +208,6 @@ public class StrategyConfig {
return this;
}
- public boolean isOverwriteEnable() {
- return overwriteEnable;
- }
-
- public StrategyConfig setOverwriteEnable(boolean overwriteEnable) {
- this.overwriteEnable = overwriteEnable;
- return this;
- }
-
public Map
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+/*
+ * Copyright (c) 2022-2023, Mybatis-Flex (fuhai999@gmail.com).
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
package com.mybatisflex.codegen.config;
@@ -34,6 +34,11 @@ public class TableDefConfig {
*/
private String classSuffix = "Def";
+ /**
+ * 是否覆盖之前生成的文件。
+ */
+ private boolean overwriteEnable;
+
public String getClassPrefix() {
return classPrefix;
}
@@ -52,4 +57,13 @@ public class TableDefConfig {
return this;
}
+ public boolean isOverwriteEnable() {
+ return overwriteEnable;
+ }
+
+ public TableDefConfig setOverwriteEnable(boolean overwriteEnable) {
+ this.overwriteEnable = overwriteEnable;
+ return this;
+ }
+
}
\ No newline at end of file
diff --git a/mybatis-flex-codegen/src/main/java/com/mybatisflex/codegen/generator/impl/ControllerGenerator.java b/mybatis-flex-codegen/src/main/java/com/mybatisflex/codegen/generator/impl/ControllerGenerator.java
index 885cc130..6ca56b6d 100644
--- a/mybatis-flex-codegen/src/main/java/com/mybatisflex/codegen/generator/impl/ControllerGenerator.java
+++ b/mybatis-flex-codegen/src/main/java/com/mybatisflex/codegen/generator/impl/ControllerGenerator.java
@@ -1,23 +1,23 @@
-/**
- * Copyright (c) 2022-2023, Mybatis-Flex (fuhai999@gmail.com).
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+/*
+ * Copyright (c) 2022-2023, Mybatis-Flex (fuhai999@gmail.com).
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
package com.mybatisflex.codegen.generator.impl;
+import com.mybatisflex.codegen.config.ControllerConfig;
import com.mybatisflex.codegen.config.GlobalConfig;
import com.mybatisflex.codegen.config.PackageConfig;
-import com.mybatisflex.codegen.config.StrategyConfig;
import com.mybatisflex.codegen.constant.TemplateConst;
import com.mybatisflex.codegen.entity.Table;
import com.mybatisflex.codegen.generator.IGenerator;
@@ -52,14 +52,14 @@ public class ControllerGenerator implements IGenerator {
}
PackageConfig packageConfig = globalConfig.getPackageConfig();
- StrategyConfig strategyConfig = globalConfig.getStrategyConfig();
-
+ ControllerConfig controllerConfig = globalConfig.getControllerConfig();
+
String controllerPackagePath = packageConfig.getControllerPackage().replace(".", "/");
File controllerJavaFile = new File(packageConfig.getSourceDir(), controllerPackagePath + "/" +
table.buildControllerClassName() + ".java");
- if (controllerJavaFile.exists() && strategyConfig.isOverwriteEnable()) {
+ if (controllerJavaFile.exists() && controllerConfig.isOverwriteEnable()) {
return;
}
@@ -67,8 +67,8 @@ public class ControllerGenerator implements IGenerator {
Map
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+/*
+ * Copyright (c) 2022-2023, Mybatis-Flex (fuhai999@gmail.com).
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
package com.mybatisflex.codegen.generator.impl;
+import com.mybatisflex.codegen.config.EntityConfig;
import com.mybatisflex.codegen.config.GlobalConfig;
import com.mybatisflex.codegen.config.PackageConfig;
-import com.mybatisflex.codegen.config.StrategyConfig;
import com.mybatisflex.codegen.constant.TemplateConst;
import com.mybatisflex.codegen.entity.Table;
import com.mybatisflex.codegen.generator.IGenerator;
@@ -52,22 +52,22 @@ public class EntityGenerator implements IGenerator {
}
PackageConfig packageConfig = globalConfig.getPackageConfig();
- StrategyConfig strategyConfig = globalConfig.getStrategyConfig();
+ EntityConfig entityConfig = globalConfig.getEntityConfig();
String entityPackagePath = packageConfig.getEntityPackage().replace(".", "/");
File entityJavaFile = new File(packageConfig.getSourceDir(), entityPackagePath + "/" +
table.buildEntityClassName() + ".java");
- if (entityJavaFile.exists() && !strategyConfig.isOverwriteEnable()) {
+ if (entityJavaFile.exists() && !entityConfig.isOverwriteEnable()) {
return;
}
Map
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+/*
+ * Copyright (c) 2022-2023, Mybatis-Flex (fuhai999@gmail.com).
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
package com.mybatisflex.codegen.generator.impl;
import com.mybatisflex.codegen.config.GlobalConfig;
+import com.mybatisflex.codegen.config.MapperConfig;
import com.mybatisflex.codegen.config.PackageConfig;
-import com.mybatisflex.codegen.config.StrategyConfig;
import com.mybatisflex.codegen.constant.TemplateConst;
import com.mybatisflex.codegen.entity.Table;
import com.mybatisflex.codegen.generator.IGenerator;
@@ -52,22 +52,22 @@ public class MapperGenerator implements IGenerator {
}
PackageConfig packageConfig = globalConfig.getPackageConfig();
- StrategyConfig strategyConfig = globalConfig.getStrategyConfig();
+ MapperConfig mapperConfig = globalConfig.getMapperConfig();
String mapperPackagePath = packageConfig.getMapperPackage().replace(".", "/");
File mapperJavaFile = new File(packageConfig.getSourceDir(), mapperPackagePath + "/" +
table.buildMapperClassName() + ".java");
- if (mapperJavaFile.exists() && !strategyConfig.isOverwriteEnable()) {
+ if (mapperJavaFile.exists() && !mapperConfig.isOverwriteEnable()) {
return;
}
Map
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+/*
+ * Copyright (c) 2022-2023, Mybatis-Flex (fuhai999@gmail.com).
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
package com.mybatisflex.codegen.generator.impl;
import com.mybatisflex.codegen.config.GlobalConfig;
+import com.mybatisflex.codegen.config.MapperXmlConfig;
import com.mybatisflex.codegen.config.PackageConfig;
-import com.mybatisflex.codegen.config.StrategyConfig;
import com.mybatisflex.codegen.constant.TemplateConst;
import com.mybatisflex.codegen.entity.Table;
import com.mybatisflex.codegen.generator.IGenerator;
@@ -52,13 +52,13 @@ public class MapperXmlGenerator implements IGenerator {
}
PackageConfig packageConfig = globalConfig.getPackageConfig();
- StrategyConfig strategyConfig = globalConfig.getStrategyConfig();
+ MapperXmlConfig mapperXmlConfig = globalConfig.getMapperXmlConfig();
File mapperXmlFile = new File(packageConfig.getMapperXmlPath() + "/" +
table.buildMapperXmlFileName() + ".xml");
- if (mapperXmlFile.exists() && !strategyConfig.isOverwriteEnable()) {
+ if (mapperXmlFile.exists() && !mapperXmlConfig.isOverwriteEnable()) {
return;
}
diff --git a/mybatis-flex-codegen/src/main/java/com/mybatisflex/codegen/generator/impl/ServiceGenerator.java b/mybatis-flex-codegen/src/main/java/com/mybatisflex/codegen/generator/impl/ServiceGenerator.java
index d2242d00..bced18f0 100644
--- a/mybatis-flex-codegen/src/main/java/com/mybatisflex/codegen/generator/impl/ServiceGenerator.java
+++ b/mybatis-flex-codegen/src/main/java/com/mybatisflex/codegen/generator/impl/ServiceGenerator.java
@@ -1,23 +1,23 @@
-/**
- * Copyright (c) 2022-2023, Mybatis-Flex (fuhai999@gmail.com).
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+/*
+ * Copyright (c) 2022-2023, Mybatis-Flex (fuhai999@gmail.com).
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
package com.mybatisflex.codegen.generator.impl;
import com.mybatisflex.codegen.config.GlobalConfig;
import com.mybatisflex.codegen.config.PackageConfig;
-import com.mybatisflex.codegen.config.StrategyConfig;
+import com.mybatisflex.codegen.config.ServiceConfig;
import com.mybatisflex.codegen.constant.TemplateConst;
import com.mybatisflex.codegen.entity.Table;
import com.mybatisflex.codegen.generator.IGenerator;
@@ -52,22 +52,22 @@ public class ServiceGenerator implements IGenerator {
}
PackageConfig packageConfig = globalConfig.getPackageConfig();
- StrategyConfig strategyConfig = globalConfig.getStrategyConfig();
+ ServiceConfig serviceConfig = globalConfig.getServiceConfig();
String servicePackagePath = packageConfig.getServicePackage().replace(".", "/");
File serviceJavaFile = new File(packageConfig.getSourceDir(), servicePackagePath + "/" +
table.buildServiceClassName() + ".java");
- if (serviceJavaFile.exists() && !strategyConfig.isOverwriteEnable()) {
+ if (serviceJavaFile.exists() && !serviceConfig.isOverwriteEnable()) {
return;
}
Map
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+/*
+ * Copyright (c) 2022-2023, Mybatis-Flex (fuhai999@gmail.com).
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
package com.mybatisflex.codegen.generator.impl;
import com.mybatisflex.codegen.config.GlobalConfig;
import com.mybatisflex.codegen.config.PackageConfig;
-import com.mybatisflex.codegen.config.StrategyConfig;
+import com.mybatisflex.codegen.config.ServiceImplConfig;
import com.mybatisflex.codegen.constant.TemplateConst;
import com.mybatisflex.codegen.entity.Table;
import com.mybatisflex.codegen.generator.IGenerator;
@@ -52,14 +52,14 @@ public class ServiceImplGenerator implements IGenerator {
}
PackageConfig packageConfig = globalConfig.getPackageConfig();
- StrategyConfig strategyConfig = globalConfig.getStrategyConfig();
+ ServiceImplConfig serviceImplConfig = globalConfig.getServiceImplConfig();
String serviceImplPackagePath = packageConfig.getServiceImplPackage().replace(".", "/");
File serviceImplJavaFile = new File(packageConfig.getSourceDir(), serviceImplPackagePath + "/" +
table.buildServiceImplClassName() + ".java");
- if (serviceImplJavaFile.exists() && !strategyConfig.isOverwriteEnable()) {
+ if (serviceImplJavaFile.exists() && !serviceImplConfig.isOverwriteEnable()) {
return;
}
@@ -67,8 +67,8 @@ public class ServiceImplGenerator implements IGenerator {
Map
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+/*
+ * Copyright (c) 2022-2023, Mybatis-Flex (fuhai999@gmail.com).
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
package com.mybatisflex.codegen.generator.impl;
import com.mybatisflex.codegen.config.GlobalConfig;
import com.mybatisflex.codegen.config.PackageConfig;
-import com.mybatisflex.codegen.config.StrategyConfig;
+import com.mybatisflex.codegen.config.TableDefConfig;
import com.mybatisflex.codegen.constant.TemplateConst;
import com.mybatisflex.codegen.entity.Table;
import com.mybatisflex.codegen.generator.IGenerator;
@@ -52,14 +52,14 @@ public class TableDefGenerator implements IGenerator {
}
PackageConfig packageConfig = globalConfig.getPackageConfig();
- StrategyConfig strategyConfig = globalConfig.getStrategyConfig();
+ TableDefConfig tableDefConfig = globalConfig.getTableDefConfig();
String tableDefPackagePath = packageConfig.getTableDefPackage().replace(".", "/");
File tableDefJavaFile = new File(packageConfig.getSourceDir(), tableDefPackagePath + "/" +
table.buildTableDefClassName() + ".java");
- if (tableDefJavaFile.exists() && !strategyConfig.isOverwriteEnable()) {
+ if (tableDefJavaFile.exists() && !tableDefConfig.isOverwriteEnable()) {
return;
}
@@ -67,8 +67,8 @@ public class TableDefGenerator implements IGenerator {
Map