From 2c1bccfc865cfafc27fbf7308c42f36b408ef13c Mon Sep 17 00:00:00 2001 From: Tom Li Date: Thu, 13 Nov 2025 20:19:52 +0800 Subject: [PATCH] change btl code gen. --- .../springblade/test/CodeGeneratorVer2.java | 100 ++++++++++++++++++ .../templates/api-fast/controller.java.btl | 78 +++++--------- .../templates/api-fast/entity.java.btl | 30 +----- .../templates/api-fast/entityDTO.java.btl | 30 +----- .../templates/api-fast/entityExcel.java.btl | 28 +---- .../templates/api-fast/entityVO.java.btl | 30 +----- .../templates/api-fast/mapper.java.btl | 36 ++----- .../templates/api-fast/mapper.xml.btl | 6 +- .../templates/api-fast/service.java.btl | 34 ++---- .../templates/api-fast/serviceImpl.java.btl | 40 ++----- .../templates/api-fast/wrapper.java.btl | 40 ++----- .../test/resources/templates/code.properties | 17 ++- 12 files changed, 189 insertions(+), 280 deletions(-) create mode 100644 blade-ops/blade-develop/src/test/java/org/springblade/test/CodeGeneratorVer2.java diff --git a/blade-ops/blade-develop/src/test/java/org/springblade/test/CodeGeneratorVer2.java b/blade-ops/blade-develop/src/test/java/org/springblade/test/CodeGeneratorVer2.java new file mode 100644 index 00000000..58cba8fc --- /dev/null +++ b/blade-ops/blade-develop/src/test/java/org/springblade/test/CodeGeneratorVer2.java @@ -0,0 +1,100 @@ +/** + * BladeX Commercial License Agreement + * Copyright (c) 2018-2099, https://bladex.cn. All rights reserved. + *

+ * Use of this software is governed by the Commercial License Agreement + * obtained after purchasing a license from BladeX. + *

+ * 1. This software is for development use only under a valid license + * from BladeX. + *

+ * 2. Redistribution of this software's source code to any third party + * without a commercial license is strictly prohibited. + *

+ * 3. Licensees may copyright their own code but cannot use segments + * from this software for such purposes. Copyright of this software + * remains with BladeX. + *

+ * Using this software signifies agreement to this License, and the software + * must not be used for illegal purposes. + *

+ * THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is + * not liable for any claims arising from secondary or illegal development. + *

+ * Author: Chill Zhuang (bladejava@qq.com) + */ +package org.springblade.test; + + +import org.springblade.develop.constant.DevelopConstant; +import org.springblade.develop.support.BladeFastCodeGenerator; + +/** + * .ver2 + */ +public class CodeGeneratorVer2 { + + /** + * 代码生成的系统类型(Boot/Cloud) + */ + public static String SYSTEM_NAME = DevelopConstant.CLOUD_NAME; + /** + * 代码生成的模块名 + */ + public static String CODE_NAME = "[检验项目]"; + /** + * 代码所在服务名 + */ + public static String SERVICE_NAME = "blade-desk"; + /** + * 代码生成的包名 + */ + public static String PACKAGE_NAME = "org.springblade.desk.quality"; + /** + * 需要去掉的表前缀 + */ + public static String[] TABLE_PREFIX = {"QA_"}; + /** + * 需要生成的表名(两者只能取其一) + */ + public static String[] INCLUDE_TABLES = {"QA_INSPECTION_ITEM"}; + /** + * 需要排除的表名(两者只能取其一) + */ + public static String[] EXCLUDE_TABLES = {}; + /** + * 是否包含基础业务字段 + */ + public static Boolean HAS_SUPER_ENTITY = Boolean.TRUE; + /** + * 基础业务字段 + */ + public static String[] SUPER_ENTITY_COLUMNS = + { + "id", + "create_time", + "create_user", + "create_dept", + "update_time", + "update_user", + "status", + "is_deleted" + }; + + /** + * RUN THIS + */ + public static void main(String[] args) { + BladeFastCodeGenerator generator = new BladeFastCodeGenerator(); + generator.setSystemName(SYSTEM_NAME); + generator.setCodeName(CODE_NAME); + generator.setServiceName(SERVICE_NAME); + generator.setPackageName(PACKAGE_NAME); + generator.setTablePrefix(TABLE_PREFIX); + generator.setIncludeTables(INCLUDE_TABLES); + generator.setExcludeTables(EXCLUDE_TABLES); + generator.setHasSuperEntity(HAS_SUPER_ENTITY); + generator.setSuperEntityColumns(SUPER_ENTITY_COLUMNS); + generator.run(); + } +} diff --git a/blade-ops/blade-develop/src/test/resources/templates/api-fast/controller.java.btl b/blade-ops/blade-develop/src/test/resources/templates/api-fast/controller.java.btl index f7b1595c..af0abee1 100644 --- a/blade-ops/blade-develop/src/test/resources/templates/api-fast/controller.java.btl +++ b/blade-ops/blade-develop/src/test/resources/templates/api-fast/controller.java.btl @@ -1,27 +1,5 @@ /** - * BladeX Commercial License Agreement - * Copyright (c) 2018-2099, https://bladex.cn. All rights reserved. - *

- * Use of this software is governed by the Commercial License Agreement - * obtained after purchasing a license from BladeX. - *

- * 1. This software is for development use only under a valid license - * from BladeX. - *

- * 2. Redistribution of this software's source code to any third party - * without a commercial license is strictly prohibited. - *

- * 3. Licensees may copyright their own code but cannot use segments - * from this software for such purposes. Copyright of this software - * remains with BladeX. - *

- * Using this software signifies agreement to this License, and the software - * must not be used for illegal purposes. - *

- * THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is - * not liable for any claims arising from secondary or illegal development. - *

- * Author: Chill Zhuang (bladejava@qq.com) + * Author: Tom Shuo */ package ${package.Controller}; @@ -41,13 +19,13 @@ import org.springblade.core.tool.utils.Func; import org.springframework.web.bind.annotation.*; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; -import ${packageName!}.pojo.entity.${entityKey!}Entity; -import ${packageName!}.pojo.vo.${entityKey!}VO; -import ${packageName!}.excel.${entityKey!}Excel; +import ${packageName!}.pojo.entity.${entityKey!}; +import ${packageName!}.pojo.vo.gen.${entityKey!}GenVO; +import ${packageName!}.excel.gen.${entityKey!}GenExcel; #if(hasWrapper) { -import ${packageName!}.wrapper.${entityKey!}Wrapper; +import ${packageName!}.wrapper.gen.${entityKey!}GenWrapper; #} -import ${packageName!}.service.${table.serviceName!}; +import ${packageName!}.service.gen.${table.serviceName!}; #if(isNotEmpty(superControllerClassPackage)){ import ${superControllerClassPackage!}; #} @@ -79,7 +57,7 @@ public class ${table.controllerName!} extends ${superControllerClass!} { public class ${table.controllerName!} { #} - private final ${table.serviceName!} ${entityKeyPath!}Service; + private final ${table.serviceName!} ${entityKeyPath!}GenService; #if(hasWrapper){ /** @@ -88,9 +66,9 @@ public class ${table.controllerName!} { @GetMapping("/detail") @ApiOperationSupport(order = 1) @Operation(summary = "详情", description = "传入${entityKeyPath!}") - public R<${entityKey!}VO> detail(${entityKey!}Entity ${entityKeyPath!}) { - ${entityKey!}Entity detail = ${entityKeyPath!}Service.getOne(Condition.getQueryWrapper(${entityKeyPath!})); - return R.data(${entityKey!}Wrapper.build().entityVO(detail)); + public R<${entityKey!}GenVO> detail(${entityKey!} ${entityKeyPath!}) { + ${entityKey!} detail = ${entityKeyPath!}GenService.getOne(Condition.getQueryWrapper(${entityKeyPath!})); + return R.data(${entityKey!}GenWrapper.build().entityVO(detail)); } /** @@ -99,9 +77,9 @@ public class ${table.controllerName!} { @GetMapping("/list") @ApiOperationSupport(order = 2) @Operation(summary = "分页", description = "传入${entityKeyPath!}") - public R> list(@Parameter(hidden = true) @RequestParam Map ${entityKeyPath!}, Query query) { - IPage<${entityKey!}Entity> pages = ${entityKeyPath!}Service.page(Condition.getPage(query), Condition.getQueryWrapper(${entityKeyPath!}, ${entityKey!}Entity.class)); - return R.data(${entityKey!}Wrapper.build().pageVO(pages)); + public R> list(@Parameter(hidden = true) @RequestParam Map ${entityKeyPath!}, Query query) { + IPage<${entityKey!}> pages = ${entityKeyPath!}GenService.page(Condition.getPage(query), Condition.getQueryWrapper(${entityKeyPath!}, ${entityKey!}.class)); + return R.data(${entityKey!}GenWrapper.build().pageVO(pages)); } #}else{ @@ -111,8 +89,8 @@ public class ${table.controllerName!} { @GetMapping("/detail") @ApiOperationSupport(order = 1) @Operation(summary = "详情", description = "传入${entityKeyPath!}") - public R<${entityKey!}Entity> detail(${entityKey!}Entity ${entityKeyPath!}) { - ${entityKey!}Entity detail = ${entityKeyPath!}Service.getOne(Condition.getQueryWrapper(${entityKeyPath!})); + public R<${entityKey!}> detail(${entityKey!} ${entityKeyPath!}) { + ${entityKey!} detail = ${entityKeyPath!}GenService.getOne(Condition.getQueryWrapper(${entityKeyPath!})); return R.data(detail); } @@ -123,7 +101,7 @@ public class ${table.controllerName!} { @ApiOperationSupport(order = 2) @Operation(summary = "分页", description = "传入${entityKeyPath!}") public R> list(@Parameter(hidden = true) @RequestParam Map ${entityKeyPath!}, Query query) { - IPage<${entityKey!}Entity> pages = ${entityKeyPath!}Service.page(Condition.getPage(query), Condition.getQueryWrapper(${entityKeyPath!}, ${entityKey!}Entity.class)); + IPage<${entityKey!}Entity> pages = ${entityKeyPath!}GenService.page(Condition.getPage(query), Condition.getQueryWrapper(${entityKeyPath!}, ${entityKey!}Entity.class)); return R.data(pages); } @@ -135,8 +113,8 @@ public class ${table.controllerName!} { @GetMapping("/page") @ApiOperationSupport(order = 3) @Operation(summary = "分页", description = "传入${entityKeyPath!}") - public R> page(${entityKey!}VO ${entityKeyPath!}, Query query) { - IPage<${entityKey!}VO> pages = ${entityKeyPath!}Service.select${entityKey!}Page(Condition.getPage(query), ${entityKeyPath!}); + public R> page(${entityKey!}GenVO ${entityKeyPath!}, Query query) { + IPage<${entityKey!}GenVO> pages = ${entityKeyPath!}GenService.select${entityKey!}Page(Condition.getPage(query), ${entityKeyPath!}); return R.data(pages); } @@ -146,8 +124,8 @@ public class ${table.controllerName!} { @PostMapping("/save") @ApiOperationSupport(order = 4) @Operation(summary = "新增", description = "传入${entityKeyPath!}") - public R save(@Valid @RequestBody ${entityKey!}Entity ${entityKeyPath!}) { - return R.status(${entityKeyPath!}Service.save(${entityKeyPath!})); + public R save(@Valid @RequestBody ${entityKey!} ${entityKeyPath!}) { + return R.status(${entityKeyPath!}GenService.save(${entityKeyPath!})); } /** @@ -156,8 +134,8 @@ public class ${table.controllerName!} { @PostMapping("/update") @ApiOperationSupport(order = 5) @Operation(summary = "修改", description = "传入${entityKeyPath!}") - public R update(@Valid @RequestBody ${entityKey!}Entity ${entityKeyPath!}) { - return R.status(${entityKeyPath!}Service.updateById(${entityKeyPath!})); + public R update(@Valid @RequestBody ${entityKey!} ${entityKeyPath!}) { + return R.status(${entityKeyPath!}GenService.updateById(${entityKeyPath!})); } /** @@ -166,8 +144,8 @@ public class ${table.controllerName!} { @PostMapping("/submit") @ApiOperationSupport(order = 6) @Operation(summary = "新增或修改", description = "传入${entityKeyPath!}") - public R submit(@Valid @RequestBody ${entityKey!}Entity ${entityKeyPath!}) { - return R.status(${entityKeyPath!}Service.saveOrUpdate(${entityKeyPath!})); + public R submit(@Valid @RequestBody ${entityKey!} ${entityKeyPath!}) { + return R.status(${entityKeyPath!}GenService.saveOrUpdate(${entityKeyPath!})); } #if(hasSuperEntity){ @@ -178,7 +156,7 @@ public class ${table.controllerName!} { @ApiOperationSupport(order = 7) @Operation(summary = "逻辑删除", description = "传入ids") public R remove(@Parameter(description = "主键集合", required = true) @RequestParam String ids) { - return R.status(${entityKeyPath!}Service.deleteLogic(Func.toLongList(ids))); + return R.status(${entityKeyPath!}GenService.deleteLogic(Func.toLongList(ids))); } #}else{ /** @@ -200,13 +178,13 @@ public class ${table.controllerName!} { @ApiOperationSupport(order = 8) @Operation(summary = "导出数据", description = "传入${entityKeyPath!}") public void export${entityKey!}(@Parameter(hidden = true) @RequestParam Map ${entityKeyPath!}, BladeUser bladeUser, HttpServletResponse response) { - QueryWrapper<${entityKey!}Entity> queryWrapper = Condition.getQueryWrapper(${entityKeyPath!}, ${entityKey!}Entity.class); + QueryWrapper<${entityKey!}> queryWrapper = Condition.getQueryWrapper(${entityKeyPath!}, ${entityKey!}.class); //if (!AuthUtil.isAdministrator()) { // queryWrapper.lambda().eq(${entity!}::getTenantId, bladeUser.getTenantId()); //} //queryWrapper.lambda().eq(${entityKey!}Entity::getIsDeleted, BladeConstant.DB_NOT_DELETED); - List<${entityKey!}Excel> list = ${entityKeyPath!}Service.export${entityKey!}(queryWrapper); - ExcelUtil.export(response, "${table.comment!}数据" + DateUtil.time(), "${table.comment!}数据表", list, ${entityKey!}Excel.class); + List<${entityKey!}GenExcel> list = ${entityKeyPath!}GenService.export${entityKey!}(queryWrapper); + ExcelUtil.export(response, "${table.comment!}数据" + DateUtil.time(), "${table.comment!}数据表", list, ${entityKey!}GenExcel.class); } } diff --git a/blade-ops/blade-develop/src/test/resources/templates/api-fast/entity.java.btl b/blade-ops/blade-develop/src/test/resources/templates/api-fast/entity.java.btl index 893dc7df..1f394ce4 100644 --- a/blade-ops/blade-develop/src/test/resources/templates/api-fast/entity.java.btl +++ b/blade-ops/blade-develop/src/test/resources/templates/api-fast/entity.java.btl @@ -1,27 +1,5 @@ /** - * BladeX Commercial License Agreement - * Copyright (c) 2018-2099, https://bladex.cn. All rights reserved. - *

- * Use of this software is governed by the Commercial License Agreement - * obtained after purchasing a license from BladeX. - *

- * 1. This software is for development use only under a valid license - * from BladeX. - *

- * 2. Redistribution of this software's source code to any third party - * without a commercial license is strictly prohibited. - *

- * 3. Licensees may copyright their own code but cannot use segments - * from this software for such purposes. Copyright of this software - * remains with BladeX. - *

- * Using this software signifies agreement to this License, and the software - * must not be used for illegal purposes. - *

- * THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is - * not liable for any claims arising from secondary or illegal development. - *

- * Author: Chill Zhuang (bladejava@qq.com) + * Author: Tom Shuo */ package ${package.Entity!}; @@ -55,15 +33,15 @@ import java.io.Serial; */ @Data @TableName("${table.name!}") -@Schema(description = "${entity!}对象") +@Schema(description = "${entityKey!} Entity对象") #if(hasSuperEntity){ @EqualsAndHashCode(callSuper = true) -public class ${entityKey!}Entity extends TenantEntity { +public class ${entityKey!} extends BaseEntity { @Serial private static final long serialVersionUID = 1L; #}else{ -public class ${entityKey!}Entity implements Serializable { +public class ${entityKey!} implements Serializable { @Serial private static final long serialVersionUID = 1L; diff --git a/blade-ops/blade-develop/src/test/resources/templates/api-fast/entityDTO.java.btl b/blade-ops/blade-develop/src/test/resources/templates/api-fast/entityDTO.java.btl index 5a56c0dc..3a6c69f1 100644 --- a/blade-ops/blade-develop/src/test/resources/templates/api-fast/entityDTO.java.btl +++ b/blade-ops/blade-develop/src/test/resources/templates/api-fast/entityDTO.java.btl @@ -1,31 +1,9 @@ /** - * BladeX Commercial License Agreement - * Copyright (c) 2018-2099, https://bladex.cn. All rights reserved. - *

- * Use of this software is governed by the Commercial License Agreement - * obtained after purchasing a license from BladeX. - *

- * 1. This software is for development use only under a valid license - * from BladeX. - *

- * 2. Redistribution of this software's source code to any third party - * without a commercial license is strictly prohibited. - *

- * 3. Licensees may copyright their own code but cannot use segments - * from this software for such purposes. Copyright of this software - * remains with BladeX. - *

- * Using this software signifies agreement to this License, and the software - * must not be used for illegal purposes. - *

- * THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is - * not liable for any claims arising from secondary or illegal development. - *

- * Author: Chill Zhuang (bladejava@qq.com) + * Author: Tom Shuo */ -package ${strutil.replace(package.Entity,"entity","dto")}; +package ${strutil.replace(package.Entity,"entity","dto.gen")}; -import ${packageName!}.pojo.entity.${entityKey!}Entity; +import ${packageName!}.pojo.entity.${entityKey!}; import lombok.Data; import lombok.EqualsAndHashCode; import java.io.Serial; @@ -38,7 +16,7 @@ import java.io.Serial; */ @Data @EqualsAndHashCode(callSuper = true) -public class ${entityKey!}DTO extends ${entityKey!}Entity { +public class ${entityKey!}GenDTO extends ${entityKey!} { @Serial private static final long serialVersionUID = 1L; diff --git a/blade-ops/blade-develop/src/test/resources/templates/api-fast/entityExcel.java.btl b/blade-ops/blade-develop/src/test/resources/templates/api-fast/entityExcel.java.btl index db8f1ccf..2f5480db 100644 --- a/blade-ops/blade-develop/src/test/resources/templates/api-fast/entityExcel.java.btl +++ b/blade-ops/blade-develop/src/test/resources/templates/api-fast/entityExcel.java.btl @@ -1,29 +1,7 @@ /** - * BladeX Commercial License Agreement - * Copyright (c) 2018-2099, https://bladex.cn. All rights reserved. - *

- * Use of this software is governed by the Commercial License Agreement - * obtained after purchasing a license from BladeX. - *

- * 1. This software is for development use only under a valid license - * from BladeX. - *

- * 2. Redistribution of this software's source code to any third party - * without a commercial license is strictly prohibited. - *

- * 3. Licensees may copyright their own code but cannot use segments - * from this software for such purposes. Copyright of this software - * remains with BladeX. - *

- * Using this software signifies agreement to this License, and the software - * must not be used for illegal purposes. - *

- * THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is - * not liable for any claims arising from secondary or illegal development. - *

- * Author: Chill Zhuang (bladejava@qq.com) + * Author: Tom Shuo */ -package ${strutil.replace(package.Entity,"pojo.entity","excel")}; +package ${strutil.replace(package.Entity,"pojo.entity","excel.gen")}; import lombok.Data; @@ -50,7 +28,7 @@ import java.io.Serial; @ColumnWidth(25) @HeadRowHeight(20) @ContentRowHeight(18) -public class ${entityKey!}Excel implements Serializable { +public class ${entityKey!}GenExcel implements Serializable { @Serial private static final long serialVersionUID = 1L; diff --git a/blade-ops/blade-develop/src/test/resources/templates/api-fast/entityVO.java.btl b/blade-ops/blade-develop/src/test/resources/templates/api-fast/entityVO.java.btl index b9b59816..3082536e 100644 --- a/blade-ops/blade-develop/src/test/resources/templates/api-fast/entityVO.java.btl +++ b/blade-ops/blade-develop/src/test/resources/templates/api-fast/entityVO.java.btl @@ -1,31 +1,9 @@ /** - * BladeX Commercial License Agreement - * Copyright (c) 2018-2099, https://bladex.cn. All rights reserved. - *

- * Use of this software is governed by the Commercial License Agreement - * obtained after purchasing a license from BladeX. - *

- * 1. This software is for development use only under a valid license - * from BladeX. - *

- * 2. Redistribution of this software's source code to any third party - * without a commercial license is strictly prohibited. - *

- * 3. Licensees may copyright their own code but cannot use segments - * from this software for such purposes. Copyright of this software - * remains with BladeX. - *

- * Using this software signifies agreement to this License, and the software - * must not be used for illegal purposes. - *

- * THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is - * not liable for any claims arising from secondary or illegal development. - *

- * Author: Chill Zhuang (bladejava@qq.com) + * Author: Tom Shuo */ -package ${strutil.replace(package.Entity,"entity","vo")}; +package ${strutil.replace(package.Entity,"entity","vo.gen")}; -import ${packageName!}.pojo.entity.${entityKey!}Entity; +import ${packageName!}.pojo.entity.${entityKey!}; import lombok.Data; import lombok.EqualsAndHashCode; import java.io.Serial; @@ -38,7 +16,7 @@ import java.io.Serial; */ @Data @EqualsAndHashCode(callSuper = true) -public class ${entityKey!}VO extends ${entityKey!}Entity { +public class ${entityKey!}GenVO extends ${entityKey!} { @Serial private static final long serialVersionUID = 1L; diff --git a/blade-ops/blade-develop/src/test/resources/templates/api-fast/mapper.java.btl b/blade-ops/blade-develop/src/test/resources/templates/api-fast/mapper.java.btl index d49c3d4a..0954e3fc 100644 --- a/blade-ops/blade-develop/src/test/resources/templates/api-fast/mapper.java.btl +++ b/blade-ops/blade-develop/src/test/resources/templates/api-fast/mapper.java.btl @@ -1,33 +1,11 @@ /** - * BladeX Commercial License Agreement - * Copyright (c) 2018-2099, https://bladex.cn. All rights reserved. - *

- * Use of this software is governed by the Commercial License Agreement - * obtained after purchasing a license from BladeX. - *

- * 1. This software is for development use only under a valid license - * from BladeX. - *

- * 2. Redistribution of this software's source code to any third party - * without a commercial license is strictly prohibited. - *

- * 3. Licensees may copyright their own code but cannot use segments - * from this software for such purposes. Copyright of this software - * remains with BladeX. - *

- * Using this software signifies agreement to this License, and the software - * must not be used for illegal purposes. - *

- * THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is - * not liable for any claims arising from secondary or illegal development. - *

- * Author: Chill Zhuang (bladejava@qq.com) + * Author: Tom Shuo */ package ${package.Mapper!}; -import ${packageName!}.pojo.entity.${entityKey!}Entity; -import ${packageName!}.pojo.vo.${entityKey!}VO; -import ${packageName!}.excel.${entityKey!}Excel; +import ${packageName!}.pojo.entity.${entityKey!}; +import ${packageName!}.pojo.vo.gen.${entityKey!}GenVO; +import ${packageName!}.excel.gen.${entityKey!}GenExcel; import ${superMapperClassPackage!}; import com.baomidou.mybatisplus.core.conditions.Wrapper; import com.baomidou.mybatisplus.core.metadata.IPage; @@ -40,7 +18,7 @@ import java.util.List; * @author ${author!} * @since ${date!} */ -public interface ${table.mapperName!} extends ${superMapperClass!}<${entityKey!}Entity> { +public interface ${table.mapperName!} extends ${superMapperClass!}<${entityKey!}> { /** * 自定义分页 @@ -49,7 +27,7 @@ public interface ${table.mapperName!} extends ${superMapperClass!}<${entityKey!} * @param ${entityKeyPath!} 查询参数 * @return List<${entityKey!}VO> */ - List<${entityKey!}VO> select${entityKey!}Page(IPage page, ${entityKey!}VO ${entityKeyPath!}); + List<${entityKey!}GenVO> select${entityKey!}Page(IPage page, ${entityKey!}GenVO ${entityKeyPath!}); /** * 获取导出数据 @@ -57,6 +35,6 @@ public interface ${table.mapperName!} extends ${superMapperClass!}<${entityKey!} * @param queryWrapper 查询条件 * @return List<${entityKey!}Excel> */ - List<${entityKey!}Excel> export${entityKey!}(@Param("ew") Wrapper<${entityKey!}Entity> queryWrapper); + List<${entityKey!}GenExcel> export${entityKey!}(@Param("ew") Wrapper<${entityKey!}> queryWrapper); } diff --git a/blade-ops/blade-develop/src/test/resources/templates/api-fast/mapper.xml.btl b/blade-ops/blade-develop/src/test/resources/templates/api-fast/mapper.xml.btl index ea15f497..fbbfc442 100644 --- a/blade-ops/blade-develop/src/test/resources/templates/api-fast/mapper.xml.btl +++ b/blade-ops/blade-develop/src/test/resources/templates/api-fast/mapper.xml.btl @@ -7,17 +7,17 @@ #} - + #for(x in table.fields) { #} - SELECT * FROM ${table.name!} \${ew.customSqlSegment} diff --git a/blade-ops/blade-develop/src/test/resources/templates/api-fast/service.java.btl b/blade-ops/blade-develop/src/test/resources/templates/api-fast/service.java.btl index 738d086f..939a555d 100644 --- a/blade-ops/blade-develop/src/test/resources/templates/api-fast/service.java.btl +++ b/blade-ops/blade-develop/src/test/resources/templates/api-fast/service.java.btl @@ -1,34 +1,12 @@ /** - * BladeX Commercial License Agreement - * Copyright (c) 2018-2099, https://bladex.cn. All rights reserved. - *

- * Use of this software is governed by the Commercial License Agreement - * obtained after purchasing a license from BladeX. - *

- * 1. This software is for development use only under a valid license - * from BladeX. - *

- * 2. Redistribution of this software's source code to any third party - * without a commercial license is strictly prohibited. - *

- * 3. Licensees may copyright their own code but cannot use segments - * from this software for such purposes. Copyright of this software - * remains with BladeX. - *

- * Using this software signifies agreement to this License, and the software - * must not be used for illegal purposes. - *

- * THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is - * not liable for any claims arising from secondary or illegal development. - *

- * Author: Chill Zhuang (bladejava@qq.com) + * Author: Tom Shuo */ package ${package.Service!}; import com.baomidou.mybatisplus.core.conditions.Wrapper; -import ${packageName!}.pojo.entity.${entityKey!}Entity; -import ${packageName!}.pojo.vo.${entityKey!}VO; -import ${packageName!}.excel.${entityKey!}Excel; +import ${packageName!}.pojo.entity.${entityKey!}; +import ${packageName!}.pojo.vo.gen.${entityKey!}GenVO; +import ${packageName!}.excel.gen.${entityKey!}GenExcel; import com.baomidou.mybatisplus.core.metadata.IPage; #if(hasSuperEntity){ import ${superServiceClassPackage!}; @@ -55,7 +33,7 @@ public interface ${table.serviceName!} extends IService<${entity!}> { * @param ${entityKeyPath!} 查询参数 * @return IPage<${entityKey!}VO> */ - IPage<${entityKey!}VO> select${entityKey!}Page(IPage<${entityKey!}VO> page, ${entityKey!}VO ${entityKeyPath!}); + IPage<${entityKey!}GenVO> select${entityKey!}Page(IPage<${entityKey!}GenVO> page, ${entityKey!}GenVO ${entityKeyPath!}); /** * 导出数据 @@ -63,6 +41,6 @@ public interface ${table.serviceName!} extends IService<${entity!}> { * @param queryWrapper 查询条件 * @return List<${entityKey!}Excel> */ - List<${entityKey!}Excel> export${entityKey!}(Wrapper<${entityKey!}Entity> queryWrapper); + List<${entityKey!}GenExcel> export${entityKey!}(Wrapper<${entityKey!}> queryWrapper); } diff --git a/blade-ops/blade-develop/src/test/resources/templates/api-fast/serviceImpl.java.btl b/blade-ops/blade-develop/src/test/resources/templates/api-fast/serviceImpl.java.btl index a5636091..711ee907 100644 --- a/blade-ops/blade-develop/src/test/resources/templates/api-fast/serviceImpl.java.btl +++ b/blade-ops/blade-develop/src/test/resources/templates/api-fast/serviceImpl.java.btl @@ -1,35 +1,13 @@ /** - * BladeX Commercial License Agreement - * Copyright (c) 2018-2099, https://bladex.cn. All rights reserved. - *

- * Use of this software is governed by the Commercial License Agreement - * obtained after purchasing a license from BladeX. - *

- * 1. This software is for development use only under a valid license - * from BladeX. - *

- * 2. Redistribution of this software's source code to any third party - * without a commercial license is strictly prohibited. - *

- * 3. Licensees may copyright their own code but cannot use segments - * from this software for such purposes. Copyright of this software - * remains with BladeX. - *

- * Using this software signifies agreement to this License, and the software - * must not be used for illegal purposes. - *

- * THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is - * not liable for any claims arising from secondary or illegal development. - *

- * Author: Chill Zhuang (bladejava@qq.com) + * Author: Tom Shuo */ package ${package.ServiceImpl!}; -import ${packageName!}.pojo.entity.${entityKey!}Entity; -import ${packageName!}.pojo.vo.${entityKey!}VO; -import ${packageName!}.excel.${entityKey!}Excel; -import ${packageName!}.mapper.${table.mapperName!}; -import ${packageName!}.service.${table.serviceName!}; +import ${packageName!}.pojo.entity.${entityKey!}; +import ${packageName!}.pojo.vo.gen.${entityKey!}GenVO; +import ${packageName!}.excel.gen.${entityKey!}GenExcel; +import ${packageName!}.mapper.gen.${table.mapperName!}; +import ${packageName!}.service.gen.${table.serviceName!}; import org.springframework.stereotype.Service; import com.baomidou.mybatisplus.core.conditions.Wrapper; import com.baomidou.mybatisplus.core.metadata.IPage; @@ -54,13 +32,13 @@ public class ${table.serviceImplName!} extends ServiceImpl<${table.mapperName!}, #} @Override - public IPage<${entityKey!}VO> select${entityKey!}Page(IPage<${entityKey!}VO> page, ${entityKey!}VO ${entityKeyPath!}) { + public IPage<${entityKey!}GenVO> select${entityKey!}Page(IPage<${entityKey!}GenVO> page, ${entityKey!}GenVO ${entityKeyPath!}) { return page.setRecords(baseMapper.select${entityKey!}Page(page, ${entityKeyPath!})); } @Override - public List<${entityKey!}Excel> export${entityKey!}(Wrapper<${entityKey!}Entity> queryWrapper) { - List<${entityKey!}Excel> ${entityKeyPath!}List = baseMapper.export${entityKey!}(queryWrapper); + public List<${entityKey!}GenExcel> export${entityKey!}(Wrapper<${entityKey!}> queryWrapper) { + List<${entityKey!}GenExcel> ${entityKeyPath!}List = baseMapper.export${entityKey!}(queryWrapper); //${entityKeyPath!}List.forEach(${entityKeyPath!} -> { // ${entityKeyPath!}.setTypeName(DictCache.getValue(DictEnum.YES_NO, ${entity!}.getType())); //}); diff --git a/blade-ops/blade-develop/src/test/resources/templates/api-fast/wrapper.java.btl b/blade-ops/blade-develop/src/test/resources/templates/api-fast/wrapper.java.btl index 83d3171c..026debb7 100644 --- a/blade-ops/blade-develop/src/test/resources/templates/api-fast/wrapper.java.btl +++ b/blade-ops/blade-develop/src/test/resources/templates/api-fast/wrapper.java.btl @@ -1,34 +1,12 @@ /** - * BladeX Commercial License Agreement - * Copyright (c) 2018-2099, https://bladex.cn. All rights reserved. - *

- * Use of this software is governed by the Commercial License Agreement - * obtained after purchasing a license from BladeX. - *

- * 1. This software is for development use only under a valid license - * from BladeX. - *

- * 2. Redistribution of this software's source code to any third party - * without a commercial license is strictly prohibited. - *

- * 3. Licensees may copyright their own code but cannot use segments - * from this software for such purposes. Copyright of this software - * remains with BladeX. - *

- * Using this software signifies agreement to this License, and the software - * must not be used for illegal purposes. - *

- * THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is - * not liable for any claims arising from secondary or illegal development. - *

- * Author: Chill Zhuang (bladejava@qq.com) + * Author: Tom Shuo */ -package ${strutil.replace(package.Entity,"pojo.entity","wrapper")}; +package ${strutil.replace(package.Entity,"pojo.entity","wrapper.gen")}; import org.springblade.core.mp.support.BaseEntityWrapper; import org.springblade.core.tool.utils.BeanUtil; -import ${packageName!}.pojo.entity.${entityKey!}Entity; -import ${packageName!}.pojo.vo.${entityKey!}VO; +import ${packageName!}.pojo.entity.${entityKey!}; +import ${packageName!}.pojo.vo.gen.${entityKey!}GenVO; import java.util.Objects; /** @@ -37,15 +15,15 @@ import java.util.Objects; * @author ${author!} * @since ${date!} */ -public class ${entityKey!}Wrapper extends BaseEntityWrapper<${entityKey!}Entity, ${entityKey!}VO> { +public class ${entityKey!}GenWrapper extends BaseEntityWrapper<${entityKey!}, ${entityKey!}GenVO> { - public static ${entityKey!}Wrapper build() { - return new ${entityKey!}Wrapper(); + public static ${entityKey!}GenWrapper build() { + return new ${entityKey!}GenWrapper(); } @Override - public ${entityKey!}VO entityVO(${entityKey!}Entity ${entityKeyPath!}) { - ${entityKey!}VO ${entityKeyPath!}VO = Objects.requireNonNull(BeanUtil.copyProperties(${entityKeyPath!}, ${entityKey!}VO.class)); + public ${entityKey!}GenVO entityVO(${entityKey!} ${entityKeyPath!}) { + ${entityKey!}GenVO ${entityKeyPath!}VO = Objects.requireNonNull(BeanUtil.copyProperties(${entityKeyPath!}, ${entityKey!}GenVO.class)); //User createUser = UserCache.getUser(${entityKeyPath!}.getCreateUser()); //User updateUser = UserCache.getUser(${entityKeyPath!}.getUpdateUser()); diff --git a/blade-ops/blade-develop/src/test/resources/templates/code.properties b/blade-ops/blade-develop/src/test/resources/templates/code.properties index 50420cb6..41e14ba9 100644 --- a/blade-ops/blade-develop/src/test/resources/templates/code.properties +++ b/blade-ops/blade-develop/src/test/resources/templates/code.properties @@ -1,5 +1,12 @@ -spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver -spring.datasource.url=jdbc:mysql://localhost:3306/bladex?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&tinyInt1isBit=false&serverTimezone=GMT%2B8&allowPublicKeyRetrieval=true -spring.datasource.username=root -spring.datasource.password=root -author=BladeX +#spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver +#spring.datasource.url=jdbc:mysql://localhost:3306/bladex?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&tinyInt1isBit=false&serverTimezone=GMT%2B8&allowPublicKeyRetrieval=true +#spring.datasource.username=root +#spring.datasource.password=root +#author=BladeX + +# QA +spring.datasource.driver-class-name=oracle.jdbc.OracleDriver +spring.datasource.url=jdbc:oracle:thin:@192.168.76.128:1521/orcl +spring.datasource.username=JONHON_MES +spring.datasource.password=oracle123456 +author=Tom Shuo \ No newline at end of file