From 2d0d5c889e1aa09ada103ae033d9bd783de72efc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=98=BF=E6=B2=90?= Date: Wed, 25 Sep 2024 21:31:49 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/resources/template/config.json | 92 ------- .../resources/template/java/Controller.java.ftl | 124 ---------- .../main/resources/template/java/Convert.java.ftl | 36 --- .../src/main/resources/template/java/Dao.java.ftl | 16 -- .../main/resources/template/java/Entity.java.ftl | 54 ----- .../main/resources/template/java/Excel.java.ftl | 49 ---- .../main/resources/template/java/Query.java.ftl | 38 --- .../main/resources/template/java/Service.java.ftl | 48 ---- .../resources/template/java/ServiceImpl.java.ftl | 264 --------------------- .../src/main/resources/template/java/VO.java.ftl | 45 ---- .../src/main/resources/template/sql/menu.sql.ftl | 33 --- .../resources/template/vue/add-or-update.vue.ftl | 108 --------- .../src/main/resources/template/vue/api.ts.ftl | 19 -- .../main/resources/template/vue/form-item.vue.ftl | 75 ------ .../src/main/resources/template/vue/form.vue.ftl | 22 -- .../src/main/resources/template/vue/index.vue.ftl | 211 ---------------- .../template/vue/sub-add-or-update.vue.ftl | 183 -------------- .../src/main/resources/template/xml/Dao.xml.ftl | 6 - 18 files changed, 1423 deletions(-) delete mode 100644 maku-boot-module/maku-module-generator/src/main/resources/template/config.json delete mode 100644 maku-boot-module/maku-module-generator/src/main/resources/template/java/Controller.java.ftl delete mode 100644 maku-boot-module/maku-module-generator/src/main/resources/template/java/Convert.java.ftl delete mode 100644 maku-boot-module/maku-module-generator/src/main/resources/template/java/Dao.java.ftl delete mode 100644 maku-boot-module/maku-module-generator/src/main/resources/template/java/Entity.java.ftl delete mode 100644 maku-boot-module/maku-module-generator/src/main/resources/template/java/Excel.java.ftl delete mode 100644 maku-boot-module/maku-module-generator/src/main/resources/template/java/Query.java.ftl delete mode 100644 maku-boot-module/maku-module-generator/src/main/resources/template/java/Service.java.ftl delete mode 100644 maku-boot-module/maku-module-generator/src/main/resources/template/java/ServiceImpl.java.ftl delete mode 100644 maku-boot-module/maku-module-generator/src/main/resources/template/java/VO.java.ftl delete mode 100644 maku-boot-module/maku-module-generator/src/main/resources/template/sql/menu.sql.ftl delete mode 100644 maku-boot-module/maku-module-generator/src/main/resources/template/vue/add-or-update.vue.ftl delete mode 100644 maku-boot-module/maku-module-generator/src/main/resources/template/vue/api.ts.ftl delete mode 100644 maku-boot-module/maku-module-generator/src/main/resources/template/vue/form-item.vue.ftl delete mode 100644 maku-boot-module/maku-module-generator/src/main/resources/template/vue/form.vue.ftl delete mode 100644 maku-boot-module/maku-module-generator/src/main/resources/template/vue/index.vue.ftl delete mode 100644 maku-boot-module/maku-module-generator/src/main/resources/template/vue/sub-add-or-update.vue.ftl delete mode 100644 maku-boot-module/maku-module-generator/src/main/resources/template/xml/Dao.xml.ftl diff --git a/maku-boot-module/maku-module-generator/src/main/resources/template/config.json b/maku-boot-module/maku-module-generator/src/main/resources/template/config.json deleted file mode 100644 index 53cdd5c..0000000 --- a/maku-boot-module/maku-module-generator/src/main/resources/template/config.json +++ /dev/null @@ -1,92 +0,0 @@ -{ - "project": { - "packageName": "net.maku", - "version": "", - "backendPath": "/Users/maku/makunet/maku-boot/maku-boot-new", - "frontendPath": "/Users/maku/makunet/maku-admin", - "tablePrefix": "tb_", - "moduleName": "test", - "author": "阿沐", - "email": "babamu@126.com" - }, - "templates": [ - { - "templateName": "java/Controller.java.ftl", - "generatorPath": "${backendPath}/src/main/java/${packagePath}/${moduleName}/controller/${ClassName}Controller.java" - }, - { - "templateName": "java/Service.java.ftl", - "generatorPath": "${backendPath}/src/main/java/${packagePath}/${moduleName}/service/${ClassName}Service.java" - }, - { - "templateName": "java/ServiceImpl.java.ftl", - "generatorPath": "${backendPath}/src/main/java/${packagePath}/${moduleName}/service/impl/${ClassName}ServiceImpl.java" - }, - { - "templateName": "java/Query.java.ftl", - "generatorPath": "${backendPath}/src/main/java/${packagePath}/${moduleName}/query/${ClassName}Query.java" - }, - { - "templateName": "java/Entity.java.ftl", - "generatorPath": "${backendPath}/src/main/java/${packagePath}/${moduleName}/entity/${ClassName}Entity.java" - }, - { - "templateName": "java/VO.java.ftl", - "generatorPath": "${backendPath}/src/main/java/${packagePath}/${moduleName}/vo/${ClassName}VO.java" - }, - { - "templateName": "java/Excel.java.ftl", - "generatorPath": "${backendPath}/src/main/java/${packagePath}/${moduleName}/vo/${ClassName}ExcelVO.java" - }, - { - "templateName": "java/Convert.java.ftl", - "generatorPath": "${backendPath}/src/main/java/${packagePath}/${moduleName}/convert/${ClassName}Convert.java" - }, - { - "templateName": "java/Dao.java.ftl", - "generatorPath": "${backendPath}/src/main/java/${packagePath}/${moduleName}/dao/${ClassName}Dao.java" - }, - { - "templateName": "xml/Dao.xml.ftl", - "generatorPath": "${backendPath}/src/main/resources/mapper/${moduleName}/${ClassName}Dao.xml" - }, - { - "templateName": "sql/menu.sql.ftl", - "generatorPath": "${backendPath}/menu/${tableName}_menu.sql" - }, - { - "templateName": "vue/api.ts.ftl", - "generatorPath": "${frontendPath}/src/api/${moduleName}/${functionName}.ts" - }, - { - "templateName": "vue/index.vue.ftl", - "generatorPath": "${frontendPath}/src/views/${moduleName}/${functionName}/index.vue" - }, - { - "templateName": "vue/add-or-update.vue.ftl", - "generatorPath": "${frontendPath}/src/views/${moduleName}/${functionName}/add-or-update.vue" - } - ], - "subTemplates": [ - { - "templateName": "java/Entity.java.ftl", - "generatorPath": "${backendPath}/src/main/java/${packagePath}/${moduleName}/entity/${ClassName}Entity.java" - }, - { - "templateName": "java/Dao.java.ftl", - "generatorPath": "${backendPath}/src/main/java/${packagePath}/${moduleName}/dao/${ClassName}Dao.java" - }, - { - "templateName": "java/VO.java.ftl", - "generatorPath": "${backendPath}/src/main/java/${packagePath}/${moduleName}/vo/${ClassName}VO.java" - }, - { - "templateName": "java/Convert.java.ftl", - "generatorPath": "${backendPath}/src/main/java/${packagePath}/${moduleName}/convert/${ClassName}Convert.java" - }, - { - "templateName": "vue/sub-add-or-update.vue.ftl", - "generatorPath": "${frontendPath}/src/views/${moduleName}/${functionName}/${className}.vue" - } - ] -} \ No newline at end of file diff --git a/maku-boot-module/maku-module-generator/src/main/resources/template/java/Controller.java.ftl b/maku-boot-module/maku-module-generator/src/main/resources/template/java/Controller.java.ftl deleted file mode 100644 index 079ba8c..0000000 --- a/maku-boot-module/maku-module-generator/src/main/resources/template/java/Controller.java.ftl +++ /dev/null @@ -1,124 +0,0 @@ -package ${package}.${moduleName}.controller; - -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.tags.Tag; -import lombok.AllArgsConstructor; -import ${package}.framework.common.utils.PageResult; -import ${package}.framework.common.utils.Result; -import ${package}.framework.operatelog.annotations.OperateLog; -import ${package}.framework.operatelog.enums.OperateTypeEnum; -import ${package}.${moduleName}.service.${ClassName}Service; -import ${package}.${moduleName}.query.${ClassName}Query; -import ${package}.${moduleName}.vo.${ClassName}VO; -import org.springdoc.core.annotations.ParameterObject; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.web.bind.annotation.*; -<#if tableOperation?seq_contains('import')> -import org.springframework.web.multipart.MultipartFile; - -import jakarta.validation.Valid; -import java.util.List; - -/** - * ${tableComment!} - * - * @author ${author} ${email!} - * MAKU - */ -@RestController -@RequestMapping("${requestUrl}") -@Tag(name="${tableComment}") -@AllArgsConstructor -public class ${ClassName}Controller { - private final ${ClassName}Service ${className}Service; - - @GetMapping("page") - @Operation(summary = "分页") - @PreAuthorize("hasAuthority('${authority}<#if authLevel==1>:page')") - public Result> page(@ParameterObject @Valid ${ClassName}Query query){ - PageResult<${ClassName}VO> page = ${className}Service.page(query); - - return Result.ok(page); - } - - <#if hasTree> - @GetMapping("list") - @Operation(summary = "列表") - @PreAuthorize("hasAuthority('${authority}<#if authLevel==1>:page')") - public Result> list(Long ${treePid}) { - List<${ClassName}VO> list = ${className}Service.list(${treePid}); - - return Result.ok(list); - } - - - @GetMapping("{id}") - @Operation(summary = "信息") - @PreAuthorize("hasAuthority('${authority}<#if authLevel==1>:info')") - public Result<${ClassName}VO> get(@PathVariable("id") Long id){ - ${ClassName}VO data = ${className}Service.get(id); - - return Result.ok(data); - } - - <#if tableOperation?seq_contains('insert')> - @PostMapping - @Operation(summary = "保存") - @OperateLog(type = OperateTypeEnum.INSERT) - @PreAuthorize("hasAuthority('${authority}<#if authLevel==1>:save')") - public Result save(@RequestBody ${ClassName}VO vo){ - ${className}Service.save(vo); - - return Result.ok(); - } - - - <#if tableOperation?seq_contains('update')> - @PutMapping - @Operation(summary = "修改") - @OperateLog(type = OperateTypeEnum.UPDATE) - @PreAuthorize("hasAuthority('${authority}<#if authLevel==1>:update')") - public Result update(@RequestBody @Valid ${ClassName}VO vo){ - ${className}Service.update(vo); - - return Result.ok(); - } - - - <#if tableOperation?seq_contains('delete')> - @DeleteMapping - @Operation(summary = "删除") - @OperateLog(type = OperateTypeEnum.DELETE) - @PreAuthorize("hasAuthority('${authority}<#if authLevel==1>:delete')") - public Result delete(@RequestBody List idList){ - ${className}Service.delete(idList); - - return Result.ok(); - } - - - <#if tableOperation?seq_contains('import')> - @PostMapping("import") - @Operation(summary = "导入") - @OperateLog(type = OperateTypeEnum.IMPORT) - @PreAuthorize("hasAuthority('${authority}<#if authLevel==1>:import')") - public Result importExcel(@RequestParam("file") MultipartFile file) { - if (file.isEmpty()) { - return Result.error("请选择需要上传的文件"); - } - ${className}Service.importByExcel(file); - - return Result.ok(); - } - - - <#if tableOperation?seq_contains('export')> - @GetMapping("export") - @Operation(summary = "导出") - @OperateLog(type = OperateTypeEnum.EXPORT) - @PreAuthorize("hasAuthority('${authority}<#if authLevel==1>:export')") - public void export() { - ${className}Service.export(); - } - -} \ No newline at end of file diff --git a/maku-boot-module/maku-module-generator/src/main/resources/template/java/Convert.java.ftl b/maku-boot-module/maku-module-generator/src/main/resources/template/java/Convert.java.ftl deleted file mode 100644 index d1e67dc..0000000 --- a/maku-boot-module/maku-module-generator/src/main/resources/template/java/Convert.java.ftl +++ /dev/null @@ -1,36 +0,0 @@ -package ${package}.${moduleName}.convert; - -import ${package}.${moduleName}.entity.${ClassName}Entity; -import ${package}.${moduleName}.vo.${ClassName}VO; -<#if !hasSub?? && (tableOperation?seq_contains('import') || tableOperation?seq_contains('export'))> -import ${package}.${moduleName}.vo.${ClassName}ExcelVO; - -import org.mapstruct.Mapper; -import org.mapstruct.factory.Mappers; - -import java.util.List; - -/** - * ${tableComment} - * - * @author ${author} ${email!} - * MAKU - */ -@Mapper -public interface ${ClassName}Convert { - ${ClassName}Convert INSTANCE = Mappers.getMapper(${ClassName}Convert.class); - - ${ClassName}Entity convert(${ClassName}VO vo); - - ${ClassName}VO convert(${ClassName}Entity entity); - - List<${ClassName}VO> convertList(List<${ClassName}Entity> list); - - List<${ClassName}Entity> convertList2(List<${ClassName}VO> list); - - <#if !hasSub?? && (tableOperation?seq_contains('import') || tableOperation?seq_contains('export'))> - List<${ClassName}ExcelVO> convertExcelList(List<${ClassName}Entity> list); - - List<${ClassName}Entity> convertExcelList2(List<${ClassName}ExcelVO> list); - -} \ No newline at end of file diff --git a/maku-boot-module/maku-module-generator/src/main/resources/template/java/Dao.java.ftl b/maku-boot-module/maku-module-generator/src/main/resources/template/java/Dao.java.ftl deleted file mode 100644 index b615951..0000000 --- a/maku-boot-module/maku-module-generator/src/main/resources/template/java/Dao.java.ftl +++ /dev/null @@ -1,16 +0,0 @@ -package ${package}.${moduleName}.dao; - -import ${package}.framework.mybatis.dao.BaseDao; -import ${package}.${moduleName}.entity.${ClassName}Entity; -import org.apache.ibatis.annotations.Mapper; - -/** - * ${tableComment} - * - * @author ${author} ${email!} - * MAKU - */ -@Mapper -public interface ${ClassName}Dao extends BaseDao<${ClassName}Entity> { - -} \ No newline at end of file diff --git a/maku-boot-module/maku-module-generator/src/main/resources/template/java/Entity.java.ftl b/maku-boot-module/maku-module-generator/src/main/resources/template/java/Entity.java.ftl deleted file mode 100644 index ccb9276..0000000 --- a/maku-boot-module/maku-module-generator/src/main/resources/template/java/Entity.java.ftl +++ /dev/null @@ -1,54 +0,0 @@ -package ${package}.${moduleName}.entity; - -import lombok.Data; -import lombok.EqualsAndHashCode; -import com.baomidou.mybatisplus.annotation.*; -<#list importList as i> -import ${i!}; - -<#if baseClass??> -import ${baseClass.packageName}.${baseClass.code}; - - -/** - * ${tableComment} - * - * @author ${author} ${email!} - * MAKU - */ -<#if baseClass??>@EqualsAndHashCode(callSuper=false) -@Data -@TableName("${tableName}") -public class ${ClassName}Entity<#if baseClass??> extends ${baseClass.code} { -<#list fieldList as field> -<#if !field.baseField> - <#if field.fieldComment!?length gt 0> - /** - * ${field.fieldComment} - */ - - <#if field.primaryPk> - @TableId - - <#if field.fieldName == 'deleted'> - @TableLogic - - <#if field.fieldName == 'version'> - @Version - - <#if field.autoFill == "INSERT"> - @TableField(value = "${field.fieldName}", fill = FieldFill.INSERT) - <#elseif field.autoFill == "INSERT_UPDATE"> - @TableField(value = "${field.fieldName}", fill = FieldFill.INSERT_UPDATE) - <#elseif field.autoFill == "UPDATE"> - @TableField(value = "${field.fieldName}", fill = FieldFill.UPDATE) - <#elseif hasTree && field.fieldName == treePid> - @TableField(value = "${field.fieldName}", updateStrategy = FieldStrategy.ALWAYS) - <#else> - @TableField(value = "${field.fieldName}") - - private ${field.attrType} ${field.attrName}; - - - -} \ No newline at end of file diff --git a/maku-boot-module/maku-module-generator/src/main/resources/template/java/Excel.java.ftl b/maku-boot-module/maku-module-generator/src/main/resources/template/java/Excel.java.ftl deleted file mode 100644 index 401dccb..0000000 --- a/maku-boot-module/maku-module-generator/src/main/resources/template/java/Excel.java.ftl +++ /dev/null @@ -1,49 +0,0 @@ -package ${package}.${moduleName}.vo; - -import lombok.Data; -import com.alibaba.excel.annotation.ExcelIgnore; -import com.alibaba.excel.annotation.ExcelProperty; -import com.fhs.core.trans.vo.TransPojo; -import com.fhs.core.trans.anno.Trans; -import com.fhs.core.trans.constant.TransType; -import ${package}.framework.common.excel.LocalDateTimeConverter; -<#list importList as i> -import ${i!}; - - -/** - * ${tableComment} - * - * @author ${author} ${email!} - * MAKU - */ -@Data -public class ${ClassName}ExcelVO implements TransPojo { -<#list gridList as field> - <#if field.attrName == 'id'> - <#assign isPrimaryKey = 'true'> - - -<#if !isPrimaryKey??> - @ExcelIgnore - private ${primaryType} ${primaryName}; - - -<#list gridList as field> - <#if field.attrType == 'LocalDateTime'> - @ExcelProperty(value = "${field.fieldComment!}", converter = LocalDateTimeConverter.class) - <#elseif field.fieldComment!?length gt 0> - @ExcelProperty("${field.fieldComment}") - - <#if field.formDict??> - private String ${field.attrName}Label; - - @ExcelIgnore - @Trans(type = TransType.DICTIONARY, key = "${field.formDict}", ref = "${field.attrName}Label") - private ${field.attrType} ${field.attrName}; - <#else> - private ${field.attrType} ${field.attrName}; - - - -} \ No newline at end of file diff --git a/maku-boot-module/maku-module-generator/src/main/resources/template/java/Query.java.ftl b/maku-boot-module/maku-module-generator/src/main/resources/template/java/Query.java.ftl deleted file mode 100644 index 651b7ec..0000000 --- a/maku-boot-module/maku-module-generator/src/main/resources/template/java/Query.java.ftl +++ /dev/null @@ -1,38 +0,0 @@ -package ${package}.${moduleName}.query; - -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; -import java.util.*; -import ${package}.framework.common.query.Query; -import org.springframework.format.annotation.DateTimeFormat; - -<#list importList as i> -import ${i!}; - - -/** - * ${tableComment}查询 - * - * @author ${author} ${email!} - * MAKU - */ -@Data -@EqualsAndHashCode(callSuper = false) -@Schema(description = "${tableComment}查询") -public class ${ClassName}Query extends Query { -<#list queryList as field> - <#if field.fieldComment!?length gt 0> - @Schema(description = "${field.fieldComment}") - - <#if field.queryFormType == 'date' || field.queryFormType == 'datetime'> - private List ${field.attrName}; - <#else> - private ${field.attrType} ${field.attrName}; - - - -<#if hasLeftTree> - private List ${leftRelationField}; - -} \ No newline at end of file diff --git a/maku-boot-module/maku-module-generator/src/main/resources/template/java/Service.java.ftl b/maku-boot-module/maku-module-generator/src/main/resources/template/java/Service.java.ftl deleted file mode 100644 index 5770367..0000000 --- a/maku-boot-module/maku-module-generator/src/main/resources/template/java/Service.java.ftl +++ /dev/null @@ -1,48 +0,0 @@ -package ${package}.${moduleName}.service; - -import ${package}.framework.common.utils.PageResult; -import ${package}.framework.mybatis.service.BaseService; -import ${package}.${moduleName}.vo.${ClassName}VO; -import ${package}.${moduleName}.query.${ClassName}Query; -import ${package}.${moduleName}.entity.${ClassName}Entity; -<#if tableOperation?seq_contains('import')> -import org.springframework.web.multipart.MultipartFile; - -import java.util.List; - -/** - * ${tableComment} - * - * @author ${author} ${email!} - * MAKU - */ -public interface ${ClassName}Service extends BaseService<${ClassName}Entity> { - - PageResult<${ClassName}VO> page(${ClassName}Query query); - - ${ClassName}VO get(Long id); - - <#if hasTree> - List<${ClassName}VO> list(Long ${treePid}); - - - <#if tableOperation?seq_contains('insert')> - void save(${ClassName}VO vo); - - - <#if tableOperation?seq_contains('update')> - void update(${ClassName}VO vo); - - - <#if tableOperation?seq_contains('delete')> - void delete(List idList); - - - <#if tableOperation?seq_contains('import')> - void importByExcel(MultipartFile file); - - - <#if tableOperation?seq_contains('export')> - void export(); - -} \ No newline at end of file diff --git a/maku-boot-module/maku-module-generator/src/main/resources/template/java/ServiceImpl.java.ftl b/maku-boot-module/maku-module-generator/src/main/resources/template/java/ServiceImpl.java.ftl deleted file mode 100644 index 4ffb4ce..0000000 --- a/maku-boot-module/maku-module-generator/src/main/resources/template/java/ServiceImpl.java.ftl +++ /dev/null @@ -1,264 +0,0 @@ -package ${package}.${moduleName}.service.impl; - -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import lombok.AllArgsConstructor; -import ${package}.framework.common.utils.PageResult; -import ${package}.framework.mybatis.service.impl.BaseServiceImpl; -import ${package}.${moduleName}.convert.${ClassName}Convert; -import ${package}.${moduleName}.entity.${ClassName}Entity; -import ${package}.${moduleName}.query.${ClassName}Query; -import ${package}.${moduleName}.vo.${ClassName}VO; -import ${package}.${moduleName}.dao.${ClassName}Dao; -import ${package}.${moduleName}.service.${ClassName}Service; -<#list subs as sub> -import ${package}.${moduleName}.convert.${sub.ClassName}Convert; -import ${package}.${moduleName}.entity.${sub.ClassName}Entity; -import ${package}.${moduleName}.dao.${sub.ClassName}Dao; - -<#if tableOperation?seq_contains('import') || tableOperation?seq_contains('export')> -import com.fhs.trans.service.impl.TransService; -import ${package}.framework.common.utils.ExcelUtils; -import ${package}.${moduleName}.vo.${ClassName}ExcelVO; -import ${package}.framework.common.excel.ExcelFinishCallBack; -import org.springframework.web.multipart.MultipartFile; - -import cn.hutool.core.util.ObjectUtil; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -import java.util.List; - -/** - * ${tableComment} - * - * @author ${author} ${email!} - * MAKU - */ -@Service -@AllArgsConstructor -public class ${ClassName}ServiceImpl extends BaseServiceImpl<${ClassName}Dao, ${ClassName}Entity> implements ${ClassName}Service { -<#if tableOperation?seq_contains('import') || tableOperation?seq_contains('export')> - private final TransService transService; - -<#list subs as sub> - private final ${sub.ClassName}Dao ${sub.className}Dao; - - - @Override - public PageResult<${ClassName}VO> page(${ClassName}Query query) { - IPage<${ClassName}Entity> page = baseMapper.selectPage(getPage(query), getWrapper(query)); - - <#if hasTree> - return new PageResult<>(getHasChild(page.getRecords()), page.getTotal()); - <#else> - return new PageResult<>(${ClassName}Convert.INSTANCE.convertList(page.getRecords()), page.getTotal()); - - } - - <#if hasTree> - @Override - public List<${ClassName}VO> list(Long ${treePid}) { - LambdaQueryWrapper<${ClassName}Entity> wrapper = Wrappers.lambdaQuery(); - wrapper.eq(${treePid} != null, ${ClassName}Entity::get${treePid?cap_first}, ${treePid}); - - List<${ClassName}Entity> list = baseMapper.selectList(wrapper); - - <#if hasTree> - return getHasChild(list); - <#else> - return ${ClassName}Convert.INSTANCE.convertList(list); - - } - - - private LambdaQueryWrapper<${ClassName}Entity> getWrapper(${ClassName}Query query){ - LambdaQueryWrapper<${ClassName}Entity> wrapper = Wrappers.lambdaQuery(); - <#list queryList as field> - <#if hasTree && field.attrName == treePid> - <#assign hasTreePid = true> - if (ObjectUtil.isNotEmpty(query.get${field.attrName?cap_first}())) { - wrapper.eq(${ClassName}Entity::get${field.attrName?cap_first}, query.get${field.attrName?cap_first}()); - } else { - wrapper.isNull(${ClassName}Entity::get${treePid?cap_first}); - } - <#else> - <#if field.queryFormType == 'date' || field.queryFormType == 'datetime'> - if (ObjectUtil.isNotEmpty(query.get${field.attrName?cap_first}())) { - wrapper.between(${ClassName}Entity::get${field.attrName?cap_first}, query.get${field.attrName?cap_first}().get(0), query.get${field.attrName?cap_first}().get(1)); - } - <#elseif field.queryType == '='> - wrapper.eq(ObjectUtil.isNotEmpty(query.get${field.attrName?cap_first}()), ${ClassName}Entity::get${field.attrName?cap_first}, query.get${field.attrName?cap_first}()); - <#elseif field.queryType == 'like'> - wrapper.like(ObjectUtil.isNotEmpty(query.get${field.attrName?cap_first}()), ${ClassName}Entity::get${field.attrName?cap_first}, query.get${field.attrName?cap_first}()); - - - - - <#if hasTree && !hasTreePid??> - wrapper.isNull(${ClassName}Entity::get${treePid?cap_first}); - - <#if hasLeftTree> - - // 左侧树过滤 - wrapper.in(query.get${leftRelationField?cap_first}() != null, ${ClassName}Entity::get${leftRelationField?cap_first}, query.get${leftRelationField?cap_first}()); - - - return wrapper; - } - - <#if hasTree> - private List<${ClassName}VO> getHasChild(List<${ClassName}Entity> entityList) { - List<${ClassName}VO> list = ${ClassName}Convert.INSTANCE.convertList(entityList); - list.forEach(vo -> { - Long count = baseMapper.selectCount(new LambdaQueryWrapper<${ClassName}Entity>().eq(${ClassName}Entity::get${treePid?cap_first}, vo.get${treeId?cap_first}())); - vo.setHasChild(count > 0); - }); - - return list; - } - - - @Override - public ${ClassName}VO get(Long id) { - ${ClassName}Entity entity = baseMapper.selectById(id); - ${ClassName}VO vo = ${ClassName}Convert.INSTANCE.convert(entity); - - <#list subs as sub> - <#if sub.mainRelation ==1> - ${sub.ClassName}Entity ${sub.className}Entity = ${sub.className}Dao.selectOne(Wrappers.lambdaQuery(${sub.ClassName}Entity.class).eq(${sub.ClassName}Entity::get${sub.ForeignKey}, id)); - vo.set${sub.ClassName}(${sub.ClassName}Convert.INSTANCE.convert(${sub.className}Entity)); - - <#if sub.mainRelation ==2> - List<${sub.ClassName}Entity> ${sub.className}List = ${sub.className}Dao.selectList(Wrappers.lambdaQuery(${sub.ClassName}Entity.class).eq(${sub.ClassName}Entity::get${sub.ForeignKey}, id)); - vo.set${sub.ClassName}(${sub.ClassName}Convert.INSTANCE.convertList(${sub.className}List)); - - - - return vo; - } - - <#if tableOperation?seq_contains('insert')> - @Override - @Transactional(rollbackFor = Exception.class) - public void save(${ClassName}VO vo) { - ${ClassName}Entity entity = ${ClassName}Convert.INSTANCE.convert(vo); - - baseMapper.insert(entity); - - <#list subs as sub> - ${sub.className}Dao.delete(Wrappers.lambdaQuery(${sub.ClassName}Entity.class).eq(${sub.ClassName}Entity::get${sub.ForeignKey}, entity.getId())); - - - <#list subs as sub> - <#if sub.mainRelation ==1> - ${sub.ClassName}Entity ${sub.className}Entity = ${sub.ClassName}Convert.INSTANCE.convert(vo.get${sub.ClassName}()); - ${sub.className}Entity.set${sub.ForeignKey}(entity.getId()); - ${sub.className}Dao.insert(${sub.className}Entity); - - <#if sub.mainRelation ==2> - List<${sub.ClassName}Entity> ${sub.className}List = ${sub.ClassName}Convert.INSTANCE.convertList2(vo.get${sub.ClassName}()); - ${sub.className}List.forEach(${sub.className}Entity -> { - ${sub.className}Entity.set${sub.ForeignKey}(entity.getId()); - ${sub.className}Dao.insert(${sub.className}Entity); - }); - - - - } - - - <#if tableOperation?seq_contains('update')> - @Override - @Transactional(rollbackFor = Exception.class) - public void update(${ClassName}VO vo) { - ${ClassName}Entity entity = ${ClassName}Convert.INSTANCE.convert(vo); - - updateById(entity); - - <#list subs as sub> - ${sub.className}Dao.delete(Wrappers.lambdaQuery(${sub.ClassName}Entity.class).eq(${sub.ClassName}Entity::get${sub.ForeignKey}, entity.getId())); - - - <#list subs as sub> - <#if sub.mainRelation ==1> - ${sub.ClassName}Entity ${sub.className}Entity = ${sub.ClassName}Convert.INSTANCE.convert(vo.get${sub.ClassName}()); - ${sub.className}Entity.set${sub.ForeignKey}(entity.getId()); - ${sub.className}Dao.insert(${sub.className}Entity); - - <#if sub.mainRelation ==2> - List<${sub.ClassName}Entity> ${sub.className}List = ${sub.ClassName}Convert.INSTANCE.convertList2(vo.get${sub.ClassName}()); - ${sub.className}List.forEach(${sub.className}Entity -> { - ${sub.className}Entity.set${sub.ForeignKey}(entity.getId()); - ${sub.className}Dao.insert(${sub.className}Entity); - }); - - - - } - - - <#if tableOperation?seq_contains('delete')> - @Override - @Transactional(rollbackFor = Exception.class) - public void delete(List idList) { - <#if hasTree> - idList.forEach(this::deleteAllChildren); - <#else> - removeByIds(idList); - - - <#if subs?size gt 0> - // 删除子表数据 - idList.forEach(id -> { - <#list subs as sub> - ${sub.className}Dao.delete(Wrappers.lambdaQuery(${sub.ClassName}Entity.class).eq(${sub.ClassName}Entity::get${sub.ForeignKey}, id)); - - }); - - } - - - <#if hasTree> - /** - * 递归删除所有子节点 - * - * @param id 节点ID - */ - private void deleteAllChildren(Long id) { - // 查询当前节点的所有子节点 - List<${ClassName}Entity> childrenList = baseMapper.selectList(new LambdaQueryWrapper<${ClassName}Entity>().eq(${ClassName}Entity::get${treePid?cap_first}, id)); - // 递归删除每个子节点 - for (${ClassName}Entity children : childrenList) { - deleteAllChildren(children.getId()); - } - - // 删除当前节点 - baseMapper.deleteById(id); - } - - - <#if tableOperation?seq_contains('import')> - @Override - public void importByExcel(MultipartFile file) { - ExcelUtils.readAnalysis(file, ${ClassName}ExcelVO.class, new ExcelFinishCallBack<>() { - @Override - public void doSaveBatch(List<${ClassName}ExcelVO> resultList) { - ExcelUtils.parseDict(resultList); - saveBatch(${ClassName}Convert.INSTANCE.convertExcelList2(resultList)); - } - }); - } - - - <#if tableOperation?seq_contains('export')> - @Override - public void export() { - List<${ClassName}ExcelVO> excelList = ${ClassName}Convert.INSTANCE.convertExcelList(list()); - transService.transBatch(excelList); - ExcelUtils.excelExport(${ClassName}ExcelVO.class, "${tableComment}", null, excelList); - } - - -} \ No newline at end of file diff --git a/maku-boot-module/maku-module-generator/src/main/resources/template/java/VO.java.ftl b/maku-boot-module/maku-module-generator/src/main/resources/template/java/VO.java.ftl deleted file mode 100644 index f727844..0000000 --- a/maku-boot-module/maku-module-generator/src/main/resources/template/java/VO.java.ftl +++ /dev/null @@ -1,45 +0,0 @@ -package ${package}.${moduleName}.vo; - -import io.swagger.v3.oas.annotations.media.Schema; -import com.fasterxml.jackson.annotation.JsonFormat; -import java.util.List; -import lombok.Data; -import java.io.Serializable; -import ${package}.framework.common.utils.DateUtils; -<#list importList as i> -import ${i!}; - - -/** - * ${tableComment} - * - * @author ${author} ${email!} - * MAKU - */ -@Data -@Schema(description = "${tableComment}") -public class ${ClassName}VO { -<#list fieldList as field> - <#if field.fieldComment!?length gt 0> - @Schema(description = "${field.fieldComment}") - - <#if field.attrType == 'LocalDateTime'> - @JsonFormat(pattern = DateUtils.DATE_TIME_PATTERN) - - private ${field.attrType} ${field.attrName}; - - -<#list subs as sub> - @Schema(description = "${sub.tableTitle}") - <#if sub.mainRelation ==1> - private ${sub.ClassName}VO ${sub.className}; - <#else> - private List<${sub.ClassName}VO> ${sub.className}; - - - - <#if hasTree> - @Schema(description = "是否有子节点") - private Boolean hasChild; - -} \ No newline at end of file diff --git a/maku-boot-module/maku-module-generator/src/main/resources/template/sql/menu.sql.ftl b/maku-boot-module/maku-module-generator/src/main/resources/template/sql/menu.sql.ftl deleted file mode 100644 index 3b6c896..0000000 --- a/maku-boot-module/maku-module-generator/src/main/resources/template/sql/menu.sql.ftl +++ /dev/null @@ -1,33 +0,0 @@ -<#assign dbTime = "now()"> -<#if dbType=="SQLServer"> - <#assign dbTime = "getDate()"> - - --- 初始化菜单 -INSERT INTO sys_menu (pid, name, url, authority, type, open_style, icon, sort, version, deleted, creator, create_time, updater, update_time) VALUES (1, '${tableComment!}', '${moduleName}/${functionName}/index', <#if authLevel==0>'${authority}'<#else>NULL, 0, 0, 'icon-menu', 0, 0, 0, 10000, ${dbTime}, 10000, ${dbTime}); - -<#if authLevel==1> - -<#assign pid = "(SELECT max(id) from sys_menu where name = '${tableComment!}')"> -<#if dbType=="MySQL"> -set @menuId = @@identity; -<#assign pid = "(SELECT @menuId)"> - - -INSERT INTO sys_menu (pid, name, url, authority, type, open_style, icon, sort, version, deleted, creator, create_time, updater, update_time) VALUES (${pid}, '查看', '', '${authority}:page', 1, 0, '', 0, 0, 0, 10000, ${dbTime}, 10000, ${dbTime}); -<#if tableOperation?seq_contains('insert')> -INSERT INTO sys_menu (pid, name, url, authority, type, open_style, icon, sort, version, deleted, creator, create_time, updater, update_time) VALUES (${pid}, '新增', '', '${authority}:save', 1, 0, '', 1, 0, 0, 10000, ${dbTime}, 10000, ${dbTime}); - -<#if tableOperation?seq_contains('update')> -INSERT INTO sys_menu (pid, name, url, authority, type, open_style, icon, sort, version, deleted, creator, create_time, updater, update_time) VALUES (${pid}, '修改', '', '${authority}:update,${authority}:info', 1, 0, '', 2, 0, 0, 10000, ${dbTime}, 10000, ${dbTime}); - -<#if tableOperation?seq_contains('delete')> -INSERT INTO sys_menu (pid, name, url, authority, type, open_style, icon, sort, version, deleted, creator, create_time, updater, update_time) VALUES (${pid}, '删除', '', '${authority}:delete', 1, 0, '', 3, 0, 0, 10000, ${dbTime}, 10000, ${dbTime}); - -<#if tableOperation?seq_contains('import')> -INSERT INTO sys_menu (pid, name, url, authority, type, open_style, icon, sort, version, deleted, creator, create_time, updater, update_time) VALUES (${pid}, '导入', '', '${authority}:import', 1, 0, '', 3, 0, 0, 10000, ${dbTime}, 10000, ${dbTime}); - -<#if tableOperation?seq_contains('export')> -INSERT INTO sys_menu (pid, name, url, authority, type, open_style, icon, sort, version, deleted, creator, create_time, updater, update_time) VALUES (${pid}, '导出', '', '${authority}:export', 1, 0, '', 3, 0, 0, 10000, ${dbTime}, 10000, ${dbTime}); - - \ No newline at end of file diff --git a/maku-boot-module/maku-module-generator/src/main/resources/template/vue/add-or-update.vue.ftl b/maku-boot-module/maku-module-generator/src/main/resources/template/vue/add-or-update.vue.ftl deleted file mode 100644 index dd5783c..0000000 --- a/maku-boot-module/maku-module-generator/src/main/resources/template/vue/add-or-update.vue.ftl +++ /dev/null @@ -1,108 +0,0 @@ -<#import "/vue/form.vue.ftl" as form> - - - diff --git a/maku-boot-module/maku-module-generator/src/main/resources/template/vue/api.ts.ftl b/maku-boot-module/maku-module-generator/src/main/resources/template/vue/api.ts.ftl deleted file mode 100644 index ea6c9d7..0000000 --- a/maku-boot-module/maku-module-generator/src/main/resources/template/vue/api.ts.ftl +++ /dev/null @@ -1,19 +0,0 @@ -import service from '@/utils/request' - -export const use${FunctionName}Api = (id: number) => { - return service.get('${requestUrl}/' + id) -} - -<#if hasTree> -export const use${FunctionName}TreeLoadApi = (${treePid}: number) => { - return service.get('${requestUrl}/list?${treePid}=' + ${treePid}) -} - - -export const use${FunctionName}SubmitApi = (dataForm: any) => { - if (dataForm.id) { - return service.put('${requestUrl}', dataForm) - } else { - return service.post('${requestUrl}', dataForm) - } -} \ No newline at end of file diff --git a/maku-boot-module/maku-module-generator/src/main/resources/template/vue/form-item.vue.ftl b/maku-boot-module/maku-module-generator/src/main/resources/template/vue/form-item.vue.ftl deleted file mode 100644 index e14934b..0000000 --- a/maku-boot-module/maku-module-generator/src/main/resources/template/vue/form-item.vue.ftl +++ /dev/null @@ -1,75 +0,0 @@ -<#macro maFormItem model field> - - <#if hasTree && field.attrName == treePid> - - <#elseif hasLeftTree?? && field.attrName == leftRelationField> - - :props="{ label: '${leftTreeLabel}', value: '${leftTreeId}' }" - url="${leftRequestUrl}/list" - <#else> - url="${leftRequestUrl}" - - /> - <#elseif field.formType == 'input'> - - <#elseif field.formType == 'number'> - - <#elseif field.formType == 'textarea'> - - <#elseif field.formType == 'editor'> - - <#elseif field.formType == 'select'> - <#if field.formDict??> - - <#else> - - - - - <#elseif field.formType == 'radio'> - <#if field.formDict??> - - <#else> - - 启用 - 禁用 - - - <#elseif field.formType == 'checkbox'> - <#if field.formDict??> - - <#else> - - 启用 - 禁用 - - - <#elseif field.formType == 'address'> - - <#elseif field.formType == 'date'> - - <#elseif field.formType == 'datetime'> - - <#elseif field.formType == 'treeselect'> - - <#elseif field.formType == 'user'> - - <#elseif field.formType == 'org'> - - <#elseif field.formType == 'post'> - - <#elseif field.formType == 'file'> - - <#elseif field.formType == 'image'> - - <#else> - - - - diff --git a/maku-boot-module/maku-module-generator/src/main/resources/template/vue/form.vue.ftl b/maku-boot-module/maku-module-generator/src/main/resources/template/vue/form.vue.ftl deleted file mode 100644 index 28becd6..0000000 --- a/maku-boot-module/maku-module-generator/src/main/resources/template/vue/form.vue.ftl +++ /dev/null @@ -1,22 +0,0 @@ -<#import "/vue/form-item.vue.ftl" as formItem> - -<#macro maForm> - - <#list formList as field> - <#if (formLayout > 1)> - <#if field_index % 2 == 0> - - - - <@formItem.maFormItem model='dataForm' field=field> - <#nt> - <#if field_index % 2 != 0 || formList?size == field_index + 1> - - - <#else> - <@formItem.maFormItem model='dataForm' field=field > - - - <#nested> - - \ No newline at end of file diff --git a/maku-boot-module/maku-module-generator/src/main/resources/template/vue/index.vue.ftl b/maku-boot-module/maku-module-generator/src/main/resources/template/vue/index.vue.ftl deleted file mode 100644 index 9083d51..0000000 --- a/maku-boot-module/maku-module-generator/src/main/resources/template/vue/index.vue.ftl +++ /dev/null @@ -1,211 +0,0 @@ - - - diff --git a/maku-boot-module/maku-module-generator/src/main/resources/template/vue/sub-add-or-update.vue.ftl b/maku-boot-module/maku-module-generator/src/main/resources/template/vue/sub-add-or-update.vue.ftl deleted file mode 100644 index 2ab3c2f..0000000 --- a/maku-boot-module/maku-module-generator/src/main/resources/template/vue/sub-add-or-update.vue.ftl +++ /dev/null @@ -1,183 +0,0 @@ -<#import "/vue/form.vue.ftl" as form> - - - diff --git a/maku-boot-module/maku-module-generator/src/main/resources/template/xml/Dao.xml.ftl b/maku-boot-module/maku-module-generator/src/main/resources/template/xml/Dao.xml.ftl deleted file mode 100644 index 5344b46..0000000 --- a/maku-boot-module/maku-module-generator/src/main/resources/template/xml/Dao.xml.ftl +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file