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
* 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)
* 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<IPage<${entityKey!}VO>> 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));
return R.data(${entityKey!}Wrapper.build().pageVO(pages));
public R<IPage<${entityKey!}GenVO>> list(@Parameter(hidden = true) @RequestParam Map<String, Object> ${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<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);
}
@ -135,8 +113,8 @@ public class ${table.controllerName!} {
@GetMapping("/page")
@ApiOperationSupport(order = 3)
@Operation(summary = "分页", description = "传入${entityKeyPath!}")
public R<IPage<${entityKey!}VO>> page(${entityKey!}VO ${entityKeyPath!}, Query query) {
IPage<${entityKey!}VO> pages = ${entityKeyPath!}Service.select${entityKey!}Page(Condition.getPage(query), ${entityKeyPath!});
public R<IPage<${entityKey!}GenVO>> 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<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()) {
// 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);
}
}

@ -1,27 +1,5 @@
/**
* 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)
* 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;

@ -1,31 +1,9 @@
/**
* 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)
* 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;

@ -1,29 +1,7 @@
/**
* 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)
* 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;

@ -1,31 +1,9 @@
/**
* 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)
* 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;

@ -1,33 +1,11 @@
/**
* 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)
* 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);
}

@ -7,17 +7,17 @@
<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) {
<result column="${x.name!}" property="${x.propertyName!}"/>
#}
</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 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>

@ -1,34 +1,12 @@
/**
* 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)
* 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);
}

@ -1,35 +1,13 @@
/**
* 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)
* 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()));
//});

@ -1,34 +1,12 @@
/**
* 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)
* 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());

@ -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
Loading…
Cancel
Save