瀏覽代碼

同步dev

hubin 7 年之前
父節點
當前提交
b400e8ff0e

+ 2 - 2
mybatis-plus-generator/src/main/java/com/baomidou/mybatisplus/generator/config/ConstVal.java

@@ -28,14 +28,14 @@ public class ConstVal {
     public static final String MODULENAME = "ModuleName";
 
     public static final String ENTITY = "Entity";
-    public static final String SERIVCE = "Service";
+    public static final String SERVICE = "Service";
     public static final String SERVICEIMPL = "ServiceImpl";
     public static final String MAPPER = "Mapper";
     public static final String XML = "Xml";
     public static final String CONTROLLER = "Controller";
 
     public static final String ENTITY_PATH = "entity_path";
-    public static final String SERIVCE_PATH = "serivce_path";
+    public static final String SERVICE_PATH = "service_path";
     public static final String SERVICEIMPL_PATH = "serviceimpl_path";
     public static final String MAPPER_PATH = "mapper_path";
     public static final String XML_PATH = "xml_path";

+ 3 - 3
mybatis-plus-generator/src/main/java/com/baomidou/mybatisplus/generator/config/builder/ConfigBuilder.java

@@ -247,7 +247,7 @@ public class ConfigBuilder {
         packageInfo.put(ConstVal.ENTITY, joinPackage(config.getParent(), config.getEntity()));
         packageInfo.put(ConstVal.MAPPER, joinPackage(config.getParent(), config.getMapper()));
         packageInfo.put(ConstVal.XML, joinPackage(config.getParent(), config.getXml()));
-        packageInfo.put(ConstVal.SERIVCE, joinPackage(config.getParent(), config.getService()));
+        packageInfo.put(ConstVal.SERVICE, joinPackage(config.getParent(), config.getService()));
         packageInfo.put(ConstVal.SERVICEIMPL, joinPackage(config.getParent(), config.getServiceImpl()));
         packageInfo.put(ConstVal.CONTROLLER, joinPackage(config.getParent(), config.getController()));
 
@@ -263,7 +263,7 @@ public class ConfigBuilder {
             pathInfo.put(ConstVal.XML_PATH, joinPath(outputDir, packageInfo.get(ConstVal.XML)));
         }
         if (StringUtils.isNotEmpty(template.getService())) {
-            pathInfo.put(ConstVal.SERIVCE_PATH, joinPath(outputDir, packageInfo.get(ConstVal.SERIVCE)));
+            pathInfo.put(ConstVal.SERVICE_PATH, joinPath(outputDir, packageInfo.get(ConstVal.SERVICE)));
         }
         if (StringUtils.isNotEmpty(template.getServiceImpl())) {
             pathInfo.put(ConstVal.SERVICEIMPL_PATH, joinPath(outputDir, packageInfo.get(ConstVal.SERVICEIMPL)));
@@ -356,7 +356,7 @@ public class ConfigBuilder {
             if (StringUtils.isNotEmpty(globalConfig.getServiceName())) {
                 tableInfo.setServiceName(String.format(globalConfig.getServiceName(), tableInfo.getEntityName()));
             } else {
-                tableInfo.setServiceName("I" + tableInfo.getEntityName() + ConstVal.SERIVCE);
+                tableInfo.setServiceName("I" + tableInfo.getEntityName() + ConstVal.SERVICE);
             }
             if (StringUtils.isNotEmpty(globalConfig.getServiceImplName())) {
                 tableInfo.setServiceImplName(String.format(globalConfig.getServiceImplName(), tableInfo.getEntityName()));

+ 2 - 2
mybatis-plus-generator/src/main/java/com/baomidou/mybatisplus/generator/engine/AbstractTemplateEngine.java

@@ -114,8 +114,8 @@ public abstract class AbstractTemplateEngine {
                     }
                 }
                 // IMpService.java
-                if (null != tableInfo.getServiceName() && null != pathInfo.get(ConstVal.SERIVCE_PATH)) {
-                    String serviceFile = String.format((pathInfo.get(ConstVal.SERIVCE_PATH) + File.separator + tableInfo.getServiceName() + this.suffixJavaOrKt()), entityName);
+                if (null != tableInfo.getServiceName() && null != pathInfo.get(ConstVal.SERVICE_PATH)) {
+                    String serviceFile = String.format((pathInfo.get(ConstVal.SERVICE_PATH) + File.separator + tableInfo.getServiceName() + this.suffixJavaOrKt()), entityName);
                     if (this.isCreate(serviceFile)) {
                         this.writer(objectMap, this.templateFilePath(template.getService()), serviceFile);
                     }

+ 2 - 2
mybatis-plus-generator/src/main/resources/templates/entity.java.ftl

@@ -73,11 +73,11 @@ public class ${entity} implements Serializable {
     @TableField("${field.name}")
 </#if>
 <#-- 乐观锁注解 -->
-<#if versionFieldName!"" == field.name>
+<#if (versionFieldName!"") == field.name>
     @Version
 </#if>
 <#-- 逻辑删除注解 -->
-<#if logicDeleteFieldName!"" == field.name>
+<#if (logicDeleteFieldName!"") == field.name>
     @TableLogic
 </#if>
     private ${field.propertyType} ${field.propertyName};

+ 2 - 2
mybatis-plus-generator/src/main/resources/templates/entity.kt.ftl

@@ -55,11 +55,11 @@ class ${entity} : Serializable {
     @TableField("${field.name}")
 </#if>
 <#-- 乐观锁注解 -->
-<#if versionFieldName!"" == field.name>
+<#if (versionFieldName!"") == field.name>
     @Version
 </#if>
 <#-- 逻辑删除注解 -->
-<#if logicDeleteFieldName!"" == field.name>
+<#if (logicDeleteFieldName!"") == field.name>
     @TableLogic
 </#if>
     var ${field.propertyName}: ${field.propertyType}? = null