Răsfoiți Sursa

生成代码优化2

wanggaokun 11 luni în urmă
părinte
comite
64bc2a8d19

+ 9 - 1
eco-modules/generator/src/main/resources/vm/java/service.java.vm

@@ -26,7 +26,15 @@ public interface I${ClassName}Service extends IBaseService<${ClassName}> {
      * @return ${functionName}
      */
         ${ClassName}Vo selectById(${pkColumn.javaType} ${pkColumn.javaField});
-
+#if($table.tree)
+    /**
+     * 查询${functionName}
+     *
+     * @param ${treeName} ${functionName}
+     * @return ${functionName}
+     */
+        ${ClassName}Vo selectByName(String ${treeName});
+#end
     /**
      * 查询${functionName}列表
      *

+ 13 - 0
eco-modules/generator/src/main/resources/vm/java/serviceImpl.java.vm

@@ -114,6 +114,19 @@ public class ${ClassName}ServiceImpl extends BaseServiceImpl<${ClassName}Mapper,
 
     }
 
+#if($table.tree)
+    /**
+     * 查询${functionName}
+     *
+     * @param ${treeName} ${functionName}主键
+     * @return ${functionName}
+     */
+    @Override
+    public ${ClassName}Vo selectByName(String ${treeName}) {
+        #set($CapitalPkColumn=${treeName.toUpperCase()})
+        return this.getOneAs(query().where(${CapitalUnderScoreClassName}.${CapitalPkColumn}.eq(${treeName})), ${ClassName}Vo.class);
+    }
+#end
     /**
      * 查询${functionName}列表
      *

+ 9 - 0
eco-modules/generator/src/main/resources/vm/java/vo-import.java.vm

@@ -3,6 +3,7 @@ package ${packageName}.domain.vo;
 #foreach ($import in $importList)
 import ${import};
 #end
+import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
 import com.alibaba.excel.annotation.ExcelProperty;
 import org.eco.common.excel.annotation.ExcelDictFormat;
 import org.eco.common.excel.convert.ExcelDictConvert;
@@ -20,6 +21,7 @@ import lombok.NoArgsConstructor;
 
 @Data
 @NoArgsConstructor
+@ExcelIgnoreUnannotated
 public class ${ClassName}ImportVo implements Serializable {
 
     @Serial
@@ -66,4 +68,11 @@ public class ${ClassName}ImportVo implements Serializable {
 #end
 #end
 
+#if($table.tree)
+    /**
+     * 显示顺序
+     */
+    @ExcelProperty(value = "显示顺序")
+    private Integer orderNum;
+#end
 }