oyq28 1 rok pred
rodič
commit
6014b9795c

+ 3 - 3
src/main/resources/templates/controller.java.ftl

@@ -52,7 +52,7 @@ import org.springframework.web.bind.annotation.RestController;
     class ${table.controllerName}<#if superControllerClass??> : ${superControllerClass}()</#if>
 <#else>
     <#if superControllerClass??>
-public class ${table.controllerName} extends SuperCacheController<${table.serviceName}, <#list table.commonFields as field><#if field.keyFlag>${field.propertyType}</#if></#list><#list table.fields as field><#if field.keyFlag>${field.propertyType}</#if></#list>, ${entity}, ${entity}PageQuery, ${entity}SaveDTO, ${entity}UpdateDTO> {
+public class ${table.controllerName} extends SuperCacheController<${table.serviceName},Long, <#list table.commonFields as field><#if field.keyFlag>${field.propertyType}</#if></#list><#list table.fields as field><#if field.keyFlag>${field.propertyType}</#if></#list>, ${entity}, ${entity}PageQuery, ${entity}SaveDTO, ${entity}UpdateDTO> {
     <#else>
 public class ${table.controllerName} {
     </#if>
@@ -61,10 +61,10 @@ public class ${table.controllerName} {
 
     @Override
     public void query(PageParams<${entity}PageQuery> params, IPage<${entity}> page, Long defSize) {
-        ToolManagementPageDTO data = params.getModel();
+        ${entity}PageQuery data = params.getModel();
         QueryWrap<${entity}> wrap = handlerWrapper(null, params);
         LbqWrapper<${entity}> wrapper = wrap.lambda();
-        ${entity} en = BeanUtil.toBean(data, ToolManagement.class);
+        ${entity} en = BeanUtil.toBean(data, ${entity}.class);
 
         <#--wrapper.like(ToolManagement::getName,shelves.getName())
         .eq(ToolManagement::getStatus,shelves.getStatus())

+ 5 - 9
src/main/resources/templates/entity.java.ftl

@@ -1,7 +1,5 @@
 package ${package.Entity};
 
-import cn.afterturn.easypoi.excel.annotation.Excel;
-import cn.afterturn.easypoi.excel.annotation.ExcelEntity;
 <#list table.importPackages as pkg>
 import ${pkg};
 </#list>
@@ -23,9 +21,7 @@ import lombok.EqualsAndHashCode;
 import lombok.NoArgsConstructor;
 import lombok.ToString;
 import lombok.experimental.Accessors;
-import ${cfg.groupId}.common.constant.DictionaryType;
-import static ${cfg.utilPackage}.utils.DateUtils.DEFAULT_DATE_TIME_FORMAT;
-import ${cfg.utilPackage}.model.EchoVO;
+
 </#if>
 <#if cfg.filedTypes??>
 <#list cfg.filedTypes as fieldType>
@@ -76,12 +72,12 @@ import static com.baomidou.mybatisplus.annotation.SqlCondition.LIKE;
 <#if superEntityClass?? && superEntityClass=="TreeEntity">
     <#assign hasCustomAnno="1"/>
 </#if>
-public class ${entity} extends ${superEntityClass}<#if activeRecord><${entity}></#if><#list table.commonFields as field><#if field.keyFlag><<#if hasCustomAnno == "1">${entity}, </#if>${field.propertyType}></#if></#list> implements EchoVO {
+public class ${entity} extends Entity<Long> {
 <#elseif activeRecord>
 @AllArgsConstructor
-public class ${entity} extends Model<${entity}> implements EchoVO {
+public class ${entity} extends Entity<Long> {
 <#else>
-public class ${entity} implements Serializable, EchoVO {
+public class ${entity} extends Entity<Long> {
 </#if>
 
     private static final long serialVersionUID = 1L;
@@ -172,7 +168,7 @@ public class ${entity} implements Serializable, EchoVO {
 <#--            <#assign myPropertyName="${field.propertyName!?substring(0,field.propertyName?index_of('Id'))}"/>-->
 <#--        </#if>-->
     </#if>
-    @Excel(name = "${fieldComment}"<#if myPropertyType!?contains("Local")>, format = DEFAULT_DATE_TIME_FORMAT, width = 20</#if><#if myPropertyType!?contains("Boolean")>, replace = {"是_true", "否_false", "_null"}</#if><#if isEnumType=="2">, replace = {<#list field.customMap.enumCustom.list?keys as key>"${field.customMap.enumCustom.list[key][0]}_${key?upper_case}", </#list> "_null"}</#if>)
+    @Excel(name = "${fieldComment}"<#if myPropertyType!?contains("Local")>, format = "yyyy-MM-dd", width = 20</#if><#if myPropertyType!?contains("Boolean")>, replace = {"是_true", "否_false", "_null"}</#if><#if isEnumType=="2">, replace = {<#list field.customMap.enumCustom.list?keys as key>"${field.customMap.enumCustom.list[key][0]}_${key?upper_case}", </#list> "_null"}</#if>)
     private ${myPropertyType} ${myPropertyName};
     </#if>
 

+ 2 - 2
src/test/java/boot/TestCodeGenerator.java

@@ -29,7 +29,7 @@ public class TestCodeGenerator {
         // 指定是boot项目
         build.setIsBoot(true);
 
-        String path = "D:\\";
+        String path = "D:\\template";
         System.out.println("输出路径:" + path);
         build.setProjectRootPath(path);
         // 项目前缀
@@ -79,7 +79,7 @@ public class TestCodeGenerator {
     }
     public static CodeGeneratorConfig buildManEntity() {
         List<String> tables = Arrays.asList(
-                "imcs_tool_management"
+                "imcs_tool_handle"
         );
         CodeGeneratorConfig build = CodeGeneratorConfig.
                 build("mall", "man", "zuihou", "imcs_", tables);