change btl code gen.

develop-QA
Tom Li 5 months ago
parent 643ab909e8
commit 2c1bccfc86
  1. 100
      blade-ops/blade-develop/src/test/java/org/springblade/test/CodeGeneratorVer2.java
  2. 78
      blade-ops/blade-develop/src/test/resources/templates/api-fast/controller.java.btl
  3. 30
      blade-ops/blade-develop/src/test/resources/templates/api-fast/entity.java.btl
  4. 30
      blade-ops/blade-develop/src/test/resources/templates/api-fast/entityDTO.java.btl
  5. 28
      blade-ops/blade-develop/src/test/resources/templates/api-fast/entityExcel.java.btl
  6. 30
      blade-ops/blade-develop/src/test/resources/templates/api-fast/entityVO.java.btl
  7. 36
      blade-ops/blade-develop/src/test/resources/templates/api-fast/mapper.java.btl
  8. 6
      blade-ops/blade-develop/src/test/resources/templates/api-fast/mapper.xml.btl
  9. 34
      blade-ops/blade-develop/src/test/resources/templates/api-fast/service.java.btl
  10. 40
      blade-ops/blade-develop/src/test/resources/templates/api-fast/serviceImpl.java.btl
  11. 40
      blade-ops/blade-develop/src/test/resources/templates/api-fast/wrapper.java.btl
  12. 17
      blade-ops/blade-develop/src/test/resources/templates/code.properties

@ -0,0 +1,100 @@
/**
* BladeX Commercial License Agreement
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
* <p>
* Use of this software is governed by the Commercial License Agreement
* obtained after purchasing a license from BladeX.
* <p>
* 1. This software is for development use only under a valid license
* from BladeX.
* <p>
* 2. Redistribution of this software's source code to any third party
* without a commercial license is strictly prohibited.
* <p>
* 3. Licensees may copyright their own code but cannot use segments
* from this software for such purposes. Copyright of this software
* remains with BladeX.
* <p>
* Using this software signifies agreement to this License, and the software
* must not be used for illegal purposes.
* <p>
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
* not liable for any claims arising from secondary or illegal development.
* <p>
* 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();
}
}

@ -1,27 +1,5 @@
/** /**
* BladeX Commercial License Agreement * Author: Tom Shuo
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
* <p>
* Use of this software is governed by the Commercial License Agreement
* obtained after purchasing a license from BladeX.
* <p>
* 1. This software is for development use only under a valid license
* from BladeX.
* <p>
* 2. Redistribution of this software's source code to any third party
* without a commercial license is strictly prohibited.
* <p>
* 3. Licensees may copyright their own code but cannot use segments
* from this software for such purposes. Copyright of this software
* remains with BladeX.
* <p>
* Using this software signifies agreement to this License, and the software
* must not be used for illegal purposes.
* <p>
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
* not liable for any claims arising from secondary or illegal development.
* <p>
* Author: Chill Zhuang (bladejava@qq.com)
*/ */
package ${package.Controller}; package ${package.Controller};
@ -41,13 +19,13 @@ import org.springblade.core.tool.utils.Func;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import ${packageName!}.pojo.entity.${entityKey!}Entity; import ${packageName!}.pojo.entity.${entityKey!};
import ${packageName!}.pojo.vo.${entityKey!}VO; import ${packageName!}.pojo.vo.gen.${entityKey!}GenVO;
import ${packageName!}.excel.${entityKey!}Excel; import ${packageName!}.excel.gen.${entityKey!}GenExcel;
#if(hasWrapper) { #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)){ #if(isNotEmpty(superControllerClassPackage)){
import ${superControllerClassPackage!}; import ${superControllerClassPackage!};
#} #}
@ -79,7 +57,7 @@ public class ${table.controllerName!} extends ${superControllerClass!} {
public class ${table.controllerName!} { public class ${table.controllerName!} {
#} #}
private final ${table.serviceName!} ${entityKeyPath!}Service; private final ${table.serviceName!} ${entityKeyPath!}GenService;
#if(hasWrapper){ #if(hasWrapper){
/** /**
@ -88,9 +66,9 @@ public class ${table.controllerName!} {
@GetMapping("/detail") @GetMapping("/detail")
@ApiOperationSupport(order = 1) @ApiOperationSupport(order = 1)
@Operation(summary = "详情", description = "传入${entityKeyPath!}") @Operation(summary = "详情", description = "传入${entityKeyPath!}")
public R<${entityKey!}VO> detail(${entityKey!}Entity ${entityKeyPath!}) { public R<${entityKey!}GenVO> detail(${entityKey!} ${entityKeyPath!}) {
${entityKey!}Entity detail = ${entityKeyPath!}Service.getOne(Condition.getQueryWrapper(${entityKeyPath!})); ${entityKey!} detail = ${entityKeyPath!}GenService.getOne(Condition.getQueryWrapper(${entityKeyPath!}));
return R.data(${entityKey!}Wrapper.build().entityVO(detail)); return R.data(${entityKey!}GenWrapper.build().entityVO(detail));
} }
/** /**
@ -99,9 +77,9 @@ public class ${table.controllerName!} {
@GetMapping("/list") @GetMapping("/list")
@ApiOperationSupport(order = 2) @ApiOperationSupport(order = 2)
@Operation(summary = "分页", description = "传入${entityKeyPath!}") @Operation(summary = "分页", description = "传入${entityKeyPath!}")
public R<IPage<${entityKey!}VO>> list(@Parameter(hidden = true) @RequestParam Map<String, Object> ${entityKeyPath!}, Query query) { public R<IPage<${entityKey!}GenVO>> list(@Parameter(hidden = true) @RequestParam Map<String, Object> ${entityKeyPath!}, Query query) {
IPage<${entityKey!}Entity> pages = ${entityKeyPath!}Service.page(Condition.getPage(query), Condition.getQueryWrapper(${entityKeyPath!}, ${entityKey!}Entity.class)); IPage<${entityKey!}> pages = ${entityKeyPath!}GenService.page(Condition.getPage(query), Condition.getQueryWrapper(${entityKeyPath!}, ${entityKey!}.class));
return R.data(${entityKey!}Wrapper.build().pageVO(pages)); return R.data(${entityKey!}GenWrapper.build().pageVO(pages));
} }
#}else{ #}else{
@ -111,8 +89,8 @@ public class ${table.controllerName!} {
@GetMapping("/detail") @GetMapping("/detail")
@ApiOperationSupport(order = 1) @ApiOperationSupport(order = 1)
@Operation(summary = "详情", description = "传入${entityKeyPath!}") @Operation(summary = "详情", description = "传入${entityKeyPath!}")
public R<${entityKey!}Entity> detail(${entityKey!}Entity ${entityKeyPath!}) { public R<${entityKey!}> detail(${entityKey!} ${entityKeyPath!}) {
${entityKey!}Entity detail = ${entityKeyPath!}Service.getOne(Condition.getQueryWrapper(${entityKeyPath!})); ${entityKey!} detail = ${entityKeyPath!}GenService.getOne(Condition.getQueryWrapper(${entityKeyPath!}));
return R.data(detail); return R.data(detail);
} }
@ -123,7 +101,7 @@ public class ${table.controllerName!} {
@ApiOperationSupport(order = 2) @ApiOperationSupport(order = 2)
@Operation(summary = "分页", description = "传入${entityKeyPath!}") @Operation(summary = "分页", description = "传入${entityKeyPath!}")
public R<IPage<${entityKey!}Entity>> list(@Parameter(hidden = true) @RequestParam Map<String, Object> ${entityKeyPath!}, Query query) { public R<IPage<${entityKey!}Entity>> list(@Parameter(hidden = true) @RequestParam Map<String, Object> ${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); return R.data(pages);
} }
@ -135,8 +113,8 @@ public class ${table.controllerName!} {
@GetMapping("/page") @GetMapping("/page")
@ApiOperationSupport(order = 3) @ApiOperationSupport(order = 3)
@Operation(summary = "分页", description = "传入${entityKeyPath!}") @Operation(summary = "分页", description = "传入${entityKeyPath!}")
public R<IPage<${entityKey!}VO>> page(${entityKey!}VO ${entityKeyPath!}, Query query) { public R<IPage<${entityKey!}GenVO>> page(${entityKey!}GenVO ${entityKeyPath!}, Query query) {
IPage<${entityKey!}VO> pages = ${entityKeyPath!}Service.select${entityKey!}Page(Condition.getPage(query), ${entityKeyPath!}); IPage<${entityKey!}GenVO> pages = ${entityKeyPath!}GenService.select${entityKey!}Page(Condition.getPage(query), ${entityKeyPath!});
return R.data(pages); return R.data(pages);
} }
@ -146,8 +124,8 @@ public class ${table.controllerName!} {
@PostMapping("/save") @PostMapping("/save")
@ApiOperationSupport(order = 4) @ApiOperationSupport(order = 4)
@Operation(summary = "新增", description = "传入${entityKeyPath!}") @Operation(summary = "新增", description = "传入${entityKeyPath!}")
public R save(@Valid @RequestBody ${entityKey!}Entity ${entityKeyPath!}) { public R save(@Valid @RequestBody ${entityKey!} ${entityKeyPath!}) {
return R.status(${entityKeyPath!}Service.save(${entityKeyPath!})); return R.status(${entityKeyPath!}GenService.save(${entityKeyPath!}));
} }
/** /**
@ -156,8 +134,8 @@ public class ${table.controllerName!} {
@PostMapping("/update") @PostMapping("/update")
@ApiOperationSupport(order = 5) @ApiOperationSupport(order = 5)
@Operation(summary = "修改", description = "传入${entityKeyPath!}") @Operation(summary = "修改", description = "传入${entityKeyPath!}")
public R update(@Valid @RequestBody ${entityKey!}Entity ${entityKeyPath!}) { public R update(@Valid @RequestBody ${entityKey!} ${entityKeyPath!}) {
return R.status(${entityKeyPath!}Service.updateById(${entityKeyPath!})); return R.status(${entityKeyPath!}GenService.updateById(${entityKeyPath!}));
} }
/** /**
@ -166,8 +144,8 @@ public class ${table.controllerName!} {
@PostMapping("/submit") @PostMapping("/submit")
@ApiOperationSupport(order = 6) @ApiOperationSupport(order = 6)
@Operation(summary = "新增或修改", description = "传入${entityKeyPath!}") @Operation(summary = "新增或修改", description = "传入${entityKeyPath!}")
public R submit(@Valid @RequestBody ${entityKey!}Entity ${entityKeyPath!}) { public R submit(@Valid @RequestBody ${entityKey!} ${entityKeyPath!}) {
return R.status(${entityKeyPath!}Service.saveOrUpdate(${entityKeyPath!})); return R.status(${entityKeyPath!}GenService.saveOrUpdate(${entityKeyPath!}));
} }
#if(hasSuperEntity){ #if(hasSuperEntity){
@ -178,7 +156,7 @@ public class ${table.controllerName!} {
@ApiOperationSupport(order = 7) @ApiOperationSupport(order = 7)
@Operation(summary = "逻辑删除", description = "传入ids") @Operation(summary = "逻辑删除", description = "传入ids")
public R remove(@Parameter(description = "主键集合", required = true) @RequestParam String 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{ #}else{
/** /**
@ -200,13 +178,13 @@ public class ${table.controllerName!} {
@ApiOperationSupport(order = 8) @ApiOperationSupport(order = 8)
@Operation(summary = "导出数据", description = "传入${entityKeyPath!}") @Operation(summary = "导出数据", description = "传入${entityKeyPath!}")
public void export${entityKey!}(@Parameter(hidden = true) @RequestParam Map<String, Object> ${entityKeyPath!}, BladeUser bladeUser, HttpServletResponse response) { public void export${entityKey!}(@Parameter(hidden = true) @RequestParam Map<String, Object> ${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()) { //if (!AuthUtil.isAdministrator()) {
// queryWrapper.lambda().eq(${entity!}::getTenantId, bladeUser.getTenantId()); // queryWrapper.lambda().eq(${entity!}::getTenantId, bladeUser.getTenantId());
//} //}
//queryWrapper.lambda().eq(${entityKey!}Entity::getIsDeleted, BladeConstant.DB_NOT_DELETED); //queryWrapper.lambda().eq(${entityKey!}Entity::getIsDeleted, BladeConstant.DB_NOT_DELETED);
List<${entityKey!}Excel> list = ${entityKeyPath!}Service.export${entityKey!}(queryWrapper); List<${entityKey!}GenExcel> list = ${entityKeyPath!}GenService.export${entityKey!}(queryWrapper);
ExcelUtil.export(response, "${table.comment!}数据" + DateUtil.time(), "${table.comment!}数据表", list, ${entityKey!}Excel.class); ExcelUtil.export(response, "${table.comment!}数据" + DateUtil.time(), "${table.comment!}数据表", list, ${entityKey!}GenExcel.class);
} }
} }

@ -1,27 +1,5 @@
/** /**
* BladeX Commercial License Agreement * Author: Tom Shuo
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
* <p>
* Use of this software is governed by the Commercial License Agreement
* obtained after purchasing a license from BladeX.
* <p>
* 1. This software is for development use only under a valid license
* from BladeX.
* <p>
* 2. Redistribution of this software's source code to any third party
* without a commercial license is strictly prohibited.
* <p>
* 3. Licensees may copyright their own code but cannot use segments
* from this software for such purposes. Copyright of this software
* remains with BladeX.
* <p>
* Using this software signifies agreement to this License, and the software
* must not be used for illegal purposes.
* <p>
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
* not liable for any claims arising from secondary or illegal development.
* <p>
* Author: Chill Zhuang (bladejava@qq.com)
*/ */
package ${package.Entity!}; package ${package.Entity!};
@ -55,15 +33,15 @@ import java.io.Serial;
*/ */
@Data @Data
@TableName("${table.name!}") @TableName("${table.name!}")
@Schema(description = "${entity!}对象") @Schema(description = "${entityKey!} Entity对象")
#if(hasSuperEntity){ #if(hasSuperEntity){
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
public class ${entityKey!}Entity extends TenantEntity { public class ${entityKey!} extends BaseEntity {
@Serial @Serial
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
#}else{ #}else{
public class ${entityKey!}Entity implements Serializable { public class ${entityKey!} implements Serializable {
@Serial @Serial
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;

@ -1,31 +1,9 @@
/** /**
* BladeX Commercial License Agreement * Author: Tom Shuo
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
* <p>
* Use of this software is governed by the Commercial License Agreement
* obtained after purchasing a license from BladeX.
* <p>
* 1. This software is for development use only under a valid license
* from BladeX.
* <p>
* 2. Redistribution of this software's source code to any third party
* without a commercial license is strictly prohibited.
* <p>
* 3. Licensees may copyright their own code but cannot use segments
* from this software for such purposes. Copyright of this software
* remains with BladeX.
* <p>
* Using this software signifies agreement to this License, and the software
* must not be used for illegal purposes.
* <p>
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
* not liable for any claims arising from secondary or illegal development.
* <p>
* Author: Chill Zhuang (bladejava@qq.com)
*/ */
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.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import java.io.Serial; import java.io.Serial;
@ -38,7 +16,7 @@ import java.io.Serial;
*/ */
@Data @Data
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
public class ${entityKey!}DTO extends ${entityKey!}Entity { public class ${entityKey!}GenDTO extends ${entityKey!} {
@Serial @Serial
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;

@ -1,29 +1,7 @@
/** /**
* BladeX Commercial License Agreement * Author: Tom Shuo
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
* <p>
* Use of this software is governed by the Commercial License Agreement
* obtained after purchasing a license from BladeX.
* <p>
* 1. This software is for development use only under a valid license
* from BladeX.
* <p>
* 2. Redistribution of this software's source code to any third party
* without a commercial license is strictly prohibited.
* <p>
* 3. Licensees may copyright their own code but cannot use segments
* from this software for such purposes. Copyright of this software
* remains with BladeX.
* <p>
* Using this software signifies agreement to this License, and the software
* must not be used for illegal purposes.
* <p>
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
* not liable for any claims arising from secondary or illegal development.
* <p>
* Author: Chill Zhuang (bladejava@qq.com)
*/ */
package ${strutil.replace(package.Entity,"pojo.entity","excel")}; package ${strutil.replace(package.Entity,"pojo.entity","excel.gen")};
import lombok.Data; import lombok.Data;
@ -50,7 +28,7 @@ import java.io.Serial;
@ColumnWidth(25) @ColumnWidth(25)
@HeadRowHeight(20) @HeadRowHeight(20)
@ContentRowHeight(18) @ContentRowHeight(18)
public class ${entityKey!}Excel implements Serializable { public class ${entityKey!}GenExcel implements Serializable {
@Serial @Serial
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;

@ -1,31 +1,9 @@
/** /**
* BladeX Commercial License Agreement * Author: Tom Shuo
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
* <p>
* Use of this software is governed by the Commercial License Agreement
* obtained after purchasing a license from BladeX.
* <p>
* 1. This software is for development use only under a valid license
* from BladeX.
* <p>
* 2. Redistribution of this software's source code to any third party
* without a commercial license is strictly prohibited.
* <p>
* 3. Licensees may copyright their own code but cannot use segments
* from this software for such purposes. Copyright of this software
* remains with BladeX.
* <p>
* Using this software signifies agreement to this License, and the software
* must not be used for illegal purposes.
* <p>
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
* not liable for any claims arising from secondary or illegal development.
* <p>
* Author: Chill Zhuang (bladejava@qq.com)
*/ */
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.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import java.io.Serial; import java.io.Serial;
@ -38,7 +16,7 @@ import java.io.Serial;
*/ */
@Data @Data
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
public class ${entityKey!}VO extends ${entityKey!}Entity { public class ${entityKey!}GenVO extends ${entityKey!} {
@Serial @Serial
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;

@ -1,33 +1,11 @@
/** /**
* BladeX Commercial License Agreement * Author: Tom Shuo
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
* <p>
* Use of this software is governed by the Commercial License Agreement
* obtained after purchasing a license from BladeX.
* <p>
* 1. This software is for development use only under a valid license
* from BladeX.
* <p>
* 2. Redistribution of this software's source code to any third party
* without a commercial license is strictly prohibited.
* <p>
* 3. Licensees may copyright their own code but cannot use segments
* from this software for such purposes. Copyright of this software
* remains with BladeX.
* <p>
* Using this software signifies agreement to this License, and the software
* must not be used for illegal purposes.
* <p>
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
* not liable for any claims arising from secondary or illegal development.
* <p>
* Author: Chill Zhuang (bladejava@qq.com)
*/ */
package ${package.Mapper!}; package ${package.Mapper!};
import ${packageName!}.pojo.entity.${entityKey!}Entity; import ${packageName!}.pojo.entity.${entityKey!};
import ${packageName!}.pojo.vo.${entityKey!}VO; import ${packageName!}.pojo.vo.gen.${entityKey!}GenVO;
import ${packageName!}.excel.${entityKey!}Excel; import ${packageName!}.excel.gen.${entityKey!}GenExcel;
import ${superMapperClassPackage!}; import ${superMapperClassPackage!};
import com.baomidou.mybatisplus.core.conditions.Wrapper; import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
@ -40,7 +18,7 @@ import java.util.List;
* @author ${author!} * @author ${author!}
* @since ${date!} * @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!} 查询参数 * @param ${entityKeyPath!} 查询参数
* @return List<${entityKey!}VO> * @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 查询条件 * @param queryWrapper 查询条件
* @return List<${entityKey!}Excel> * @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);
} }

@ -7,17 +7,17 @@
<cache type="org.mybatis.caches.ehcache.LoggingEhcache"/> <cache type="org.mybatis.caches.ehcache.LoggingEhcache"/>
#} #}
<!-- 通用查询映射结果 --> <!-- 通用查询映射结果 -->
<resultMap id="${entityKeyPath!}ResultMap" type="${package.Entity!}.${entityKey!}Entity"> <resultMap id="${entityKeyPath!}ResultMap" type="${package.Entity!}.${entityKey!}">
#for(x in table.fields) { #for(x in table.fields) {
<result column="${x.name!}" property="${x.propertyName!}"/> <result column="${x.name!}" property="${x.propertyName!}"/>
#} #}
</resultMap> </resultMap>
<select id="select${entityKey!}Page" resultMap="${entityKeyPath!}ResultMap"> <select id="select${entityKey!}Page" resultMap="${entityKeyPath!}ResultMap">
select * from ${table.name} where is_deleted = 0 SELECT * FROM ${table.name} WHERE is_deleted = 0
</select> </select>
<select id="export${entityKey!}" resultType="${packageName!}.excel.${entityKey!}Excel"> <select id="export${entityKey!}" resultType="${packageName!}.excel.gen.${entityKey!}GenExcel">
SELECT * FROM ${table.name!} \${ew.customSqlSegment} SELECT * FROM ${table.name!} \${ew.customSqlSegment}
</select> </select>

@ -1,34 +1,12 @@
/** /**
* BladeX Commercial License Agreement * Author: Tom Shuo
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
* <p>
* Use of this software is governed by the Commercial License Agreement
* obtained after purchasing a license from BladeX.
* <p>
* 1. This software is for development use only under a valid license
* from BladeX.
* <p>
* 2. Redistribution of this software's source code to any third party
* without a commercial license is strictly prohibited.
* <p>
* 3. Licensees may copyright their own code but cannot use segments
* from this software for such purposes. Copyright of this software
* remains with BladeX.
* <p>
* Using this software signifies agreement to this License, and the software
* must not be used for illegal purposes.
* <p>
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
* not liable for any claims arising from secondary or illegal development.
* <p>
* Author: Chill Zhuang (bladejava@qq.com)
*/ */
package ${package.Service!}; package ${package.Service!};
import com.baomidou.mybatisplus.core.conditions.Wrapper; import com.baomidou.mybatisplus.core.conditions.Wrapper;
import ${packageName!}.pojo.entity.${entityKey!}Entity; import ${packageName!}.pojo.entity.${entityKey!};
import ${packageName!}.pojo.vo.${entityKey!}VO; import ${packageName!}.pojo.vo.gen.${entityKey!}GenVO;
import ${packageName!}.excel.${entityKey!}Excel; import ${packageName!}.excel.gen.${entityKey!}GenExcel;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
#if(hasSuperEntity){ #if(hasSuperEntity){
import ${superServiceClassPackage!}; import ${superServiceClassPackage!};
@ -55,7 +33,7 @@ public interface ${table.serviceName!} extends IService<${entity!}> {
* @param ${entityKeyPath!} 查询参数 * @param ${entityKeyPath!} 查询参数
* @return IPage<${entityKey!}VO> * @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 查询条件 * @param queryWrapper 查询条件
* @return List<${entityKey!}Excel> * @return List<${entityKey!}Excel>
*/ */
List<${entityKey!}Excel> export${entityKey!}(Wrapper<${entityKey!}Entity> queryWrapper); List<${entityKey!}GenExcel> export${entityKey!}(Wrapper<${entityKey!}> queryWrapper);
} }

@ -1,35 +1,13 @@
/** /**
* BladeX Commercial License Agreement * Author: Tom Shuo
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
* <p>
* Use of this software is governed by the Commercial License Agreement
* obtained after purchasing a license from BladeX.
* <p>
* 1. This software is for development use only under a valid license
* from BladeX.
* <p>
* 2. Redistribution of this software's source code to any third party
* without a commercial license is strictly prohibited.
* <p>
* 3. Licensees may copyright their own code but cannot use segments
* from this software for such purposes. Copyright of this software
* remains with BladeX.
* <p>
* Using this software signifies agreement to this License, and the software
* must not be used for illegal purposes.
* <p>
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
* not liable for any claims arising from secondary or illegal development.
* <p>
* Author: Chill Zhuang (bladejava@qq.com)
*/ */
package ${package.ServiceImpl!}; package ${package.ServiceImpl!};
import ${packageName!}.pojo.entity.${entityKey!}Entity; import ${packageName!}.pojo.entity.${entityKey!};
import ${packageName!}.pojo.vo.${entityKey!}VO; import ${packageName!}.pojo.vo.gen.${entityKey!}GenVO;
import ${packageName!}.excel.${entityKey!}Excel; import ${packageName!}.excel.gen.${entityKey!}GenExcel;
import ${packageName!}.mapper.${table.mapperName!}; import ${packageName!}.mapper.gen.${table.mapperName!};
import ${packageName!}.service.${table.serviceName!}; import ${packageName!}.service.gen.${table.serviceName!};
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.core.conditions.Wrapper; import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
@ -54,13 +32,13 @@ public class ${table.serviceImplName!} extends ServiceImpl<${table.mapperName!},
#} #}
@Override @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!})); return page.setRecords(baseMapper.select${entityKey!}Page(page, ${entityKeyPath!}));
} }
@Override @Override
public List<${entityKey!}Excel> export${entityKey!}(Wrapper<${entityKey!}Entity> queryWrapper) { public List<${entityKey!}GenExcel> export${entityKey!}(Wrapper<${entityKey!}> queryWrapper) {
List<${entityKey!}Excel> ${entityKeyPath!}List = baseMapper.export${entityKey!}(queryWrapper); List<${entityKey!}GenExcel> ${entityKeyPath!}List = baseMapper.export${entityKey!}(queryWrapper);
//${entityKeyPath!}List.forEach(${entityKeyPath!} -> { //${entityKeyPath!}List.forEach(${entityKeyPath!} -> {
// ${entityKeyPath!}.setTypeName(DictCache.getValue(DictEnum.YES_NO, ${entity!}.getType())); // ${entityKeyPath!}.setTypeName(DictCache.getValue(DictEnum.YES_NO, ${entity!}.getType()));
//}); //});

@ -1,34 +1,12 @@
/** /**
* BladeX Commercial License Agreement * Author: Tom Shuo
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
* <p>
* Use of this software is governed by the Commercial License Agreement
* obtained after purchasing a license from BladeX.
* <p>
* 1. This software is for development use only under a valid license
* from BladeX.
* <p>
* 2. Redistribution of this software's source code to any third party
* without a commercial license is strictly prohibited.
* <p>
* 3. Licensees may copyright their own code but cannot use segments
* from this software for such purposes. Copyright of this software
* remains with BladeX.
* <p>
* Using this software signifies agreement to this License, and the software
* must not be used for illegal purposes.
* <p>
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
* not liable for any claims arising from secondary or illegal development.
* <p>
* Author: Chill Zhuang (bladejava@qq.com)
*/ */
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.mp.support.BaseEntityWrapper;
import org.springblade.core.tool.utils.BeanUtil; import org.springblade.core.tool.utils.BeanUtil;
import ${packageName!}.pojo.entity.${entityKey!}Entity; import ${packageName!}.pojo.entity.${entityKey!};
import ${packageName!}.pojo.vo.${entityKey!}VO; import ${packageName!}.pojo.vo.gen.${entityKey!}GenVO;
import java.util.Objects; import java.util.Objects;
/** /**
@ -37,15 +15,15 @@ import java.util.Objects;
* @author ${author!} * @author ${author!}
* @since ${date!} * @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() { public static ${entityKey!}GenWrapper build() {
return new ${entityKey!}Wrapper(); return new ${entityKey!}GenWrapper();
} }
@Override @Override
public ${entityKey!}VO entityVO(${entityKey!}Entity ${entityKeyPath!}) { public ${entityKey!}GenVO entityVO(${entityKey!} ${entityKeyPath!}) {
${entityKey!}VO ${entityKeyPath!}VO = Objects.requireNonNull(BeanUtil.copyProperties(${entityKeyPath!}, ${entityKey!}VO.class)); ${entityKey!}GenVO ${entityKeyPath!}VO = Objects.requireNonNull(BeanUtil.copyProperties(${entityKeyPath!}, ${entityKey!}GenVO.class));
//User createUser = UserCache.getUser(${entityKeyPath!}.getCreateUser()); //User createUser = UserCache.getUser(${entityKeyPath!}.getCreateUser());
//User updateUser = UserCache.getUser(${entityKeyPath!}.getUpdateUser()); //User updateUser = UserCache.getUser(${entityKeyPath!}.getUpdateUser());

@ -1,5 +1,12 @@
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver #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.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.username=root
spring.datasource.password=root #spring.datasource.password=root
author=BladeX #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
Loading…
Cancel
Save