This commit is contained in:
kk
2026-07-08 17:57:11 +08:00
commit f1e6599892
743 changed files with 159169 additions and 0 deletions
@@ -0,0 +1,88 @@
/**
* 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;
public class CodeGenerator {
/**
* 代码生成的系统类型(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";
/**
* 需要去掉的表前缀
*/
public static String[] TABLE_PREFIX = {"blade_"};
/**
* 需要生成的表名(两者只能取其一)
*/
public static String[] INCLUDE_TABLES = {"blade_notice"};
/**
* 需要排除的表名(两者只能取其一)
*/
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();
}
}
@@ -0,0 +1,212 @@
/**
* 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 ${package.Controller};
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import lombok.AllArgsConstructor;
import jakarta.validation.Valid;
import org.springblade.core.secure.BladeUser;
import org.springblade.core.secure.annotation.IsAdmin;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
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;
#if(hasWrapper) {
import ${packageName!}.wrapper.${entityKey!}Wrapper;
#}
import ${packageName!}.service.${table.serviceName!};
#if(isNotEmpty(superControllerClassPackage)){
import ${superControllerClassPackage!};
#}
import org.springblade.core.tool.utils.DateUtil;
import org.springblade.core.excel.util.ExcelUtil;
import org.springblade.core.tool.constant.BladeConstant;
import java.util.Map;
import java.util.List;
import jakarta.servlet.http.HttpServletResponse;
/**
* ${table.comment!} 控制器
*
* @author ${author!}
* @since ${date!}
*/
@RestController
@AllArgsConstructor
#if(hasServiceName) {
@RequestMapping("${serviceName!}/${entityKeyPath!}")
#}else{
@RequestMapping("/${entityKeyPath!}")
#}
@Tag(name = "${table.comment!}", description = "${table.comment!}接口")
#if(isNotEmpty(superControllerClass)){
public class ${table.controllerName!} extends ${superControllerClass!} {
#}
#else{
public class ${table.controllerName!} {
#}
private final ${table.serviceName!} ${entityKeyPath!}Service;
#if(hasWrapper){
/**
* ${table.comment!} 详情
*/
@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));
}
/**
* ${table.comment!} 分页
*/
@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));
}
#}else{
/**
* ${table.comment!} 详情
*/
@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!}));
return R.data(detail);
}
/**
* ${table.comment!} 分页
*/
@GetMapping("/list")
@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));
return R.data(pages);
}
#}
/**
* ${table.comment!} 自定义分页
*/
@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!});
return R.data(pages);
}
/**
* ${table.comment!} 新增
*/
@PostMapping("/save")
@ApiOperationSupport(order = 4)
@Operation(summary = "新增", description = "传入${entityKeyPath!}")
public R save(@Valid @RequestBody ${entityKey!}Entity ${entityKeyPath!}) {
return R.status(${entityKeyPath!}Service.save(${entityKeyPath!}));
}
/**
* ${table.comment!} 修改
*/
@PostMapping("/update")
@ApiOperationSupport(order = 5)
@Operation(summary = "修改", description = "传入${entityKeyPath!}")
public R update(@Valid @RequestBody ${entityKey!}Entity ${entityKeyPath!}) {
return R.status(${entityKeyPath!}Service.updateById(${entityKeyPath!}));
}
/**
* ${table.comment!} 新增或修改
*/
@PostMapping("/submit")
@ApiOperationSupport(order = 6)
@Operation(summary = "新增或修改", description = "传入${entityKeyPath!}")
public R submit(@Valid @RequestBody ${entityKey!}Entity ${entityKeyPath!}) {
return R.status(${entityKeyPath!}Service.saveOrUpdate(${entityKeyPath!}));
}
#if(hasSuperEntity){
/**
* ${table.comment!} 删除
*/
@PostMapping("/remove")
@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)));
}
#}else{
/**
* ${table.comment!} 删除
*/
@PostMapping("/remove")
@ApiOperationSupport(order = 7)
@Operation(summary = "删除", description = "传入ids")
public R remove(@Parameter(description = "主键集合", required = true) @RequestParam String ids) {
return R.status(${entityKeyPath!}Service.removeByIds(Func.toLongList(ids)));
}
#}
/**
* 导出数据
*/
@IsAdmin
@GetMapping("/export-${entityKeyPath!}")
@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);
//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);
}
}
@@ -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 ${package.Entity!};
import lombok.Data;
import io.swagger.v3.oas.annotations.media.Schema;
#for(x in table.importPackages){
#if(isNotEmpty(x)){
#if(hasSuperEntity&&!strutil.contain(x,"Serializable")){
import ${x!};
#}
#if(!hasSuperEntity&&!strutil.contain(x,"TenantEntity")){
import ${x!};
#}
#}
#}
#if(hasSuperEntity){
import lombok.EqualsAndHashCode;
#}else{
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
#}
import java.io.Serial;
/**
* ${table.comment!} 实体类
*
* @author ${author!}
* @since ${date!}
*/
@Data
@TableName("${table.name!}")
@Schema(description = "${entity!}对象")
#if(hasSuperEntity){
@EqualsAndHashCode(callSuper = true)
public class ${entityKey!}Entity extends TenantEntity {
@Serial
private static final long serialVersionUID = 1L;
#}else{
public class ${entityKey!}Entity implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
/**
* 主键
*/
@JsonSerialize(using = ToStringSerializer.class)
@Schema(description = "主键")
@TableId(value = "id", type = IdType.ASSIGN_ID)
private Long id;
#}
#for(x in table.fields) {
#if(hasSuperEntity){
#if(x.propertyName!="id"&&x.propertyName!="createUser"&&x.propertyName!="createDept"&&x.propertyName!="createTime"&&x.propertyName!="updateUser"&&x.propertyName!="updateTime"&&x.propertyName!="status"&&x.propertyName!="isDeleted"&&x.propertyName!="tenantId"){
/**
* ${x.comment!}
*/
@Schema(description = "${x.comment!}")
private ${x.propertyType!} ${x.propertyName!};
#}
#}else{
#if(x.propertyName!="id"){
/**
* ${x.comment!}
*/
@Schema(description = "${x.comment!}")
private ${x.propertyType!} ${x.propertyName!};
#}
#}
#}
}
@@ -0,0 +1,45 @@
/**
* 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 ${strutil.replace(package.Entity,"entity","dto")};
import ${packageName!}.pojo.entity.${entityKey!}Entity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serial;
/**
* ${table.comment!} 数据传输对象实体类
*
* @author ${author!}
* @since ${date!}
*/
@Data
@EqualsAndHashCode(callSuper = true)
public class ${entityKey!}DTO extends ${entityKey!}Entity {
@Serial
private static final long serialVersionUID = 1L;
}
@@ -0,0 +1,69 @@
/**
* 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 ${strutil.replace(package.Entity,"pojo.entity","excel")};
import lombok.Data;
#for(x in table.importPackages){
#if(isNotEmpty(x)&&!strutil.contain(x,"TableName")&&!strutil.contain(x,"TenantEntity")){
import ${x!};
#}
#}
import cn.idev.excel.annotation.ExcelProperty;
import cn.idev.excel.annotation.write.style.ColumnWidth;
import cn.idev.excel.annotation.write.style.ContentRowHeight;
import cn.idev.excel.annotation.write.style.HeadRowHeight;
import java.io.Serial;
/**
* ${table.comment!} Excel实体类
*
* @author ${author!}
* @since ${date!}
*/
@Data
@ColumnWidth(25)
@HeadRowHeight(20)
@ContentRowHeight(18)
public class ${entityKey!}Excel implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
#for(x in table.fields) {
#if(x.propertyName!="createUser"&&x.propertyName!="createDept"&&x.propertyName!="createTime"&&x.propertyName!="updateUser"&&x.propertyName!="updateTime"){
/**
* ${x.comment!}
*/
@ColumnWidth(20)
@ExcelProperty("${x.comment!}")
private ${x.propertyType!} ${x.propertyName!};
#}
#}
}
@@ -0,0 +1,45 @@
/**
* 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 ${strutil.replace(package.Entity,"entity","vo")};
import ${packageName!}.pojo.entity.${entityKey!}Entity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serial;
/**
* ${table.comment!} 视图实体类
*
* @author ${author!}
* @since ${date!}
*/
@Data
@EqualsAndHashCode(callSuper = true)
public class ${entityKey!}VO extends ${entityKey!}Entity {
@Serial
private static final long serialVersionUID = 1L;
}
@@ -0,0 +1,62 @@
/**
* 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 ${package.Mapper!};
import ${packageName!}.pojo.entity.${entityKey!}Entity;
import ${packageName!}.pojo.vo.${entityKey!}VO;
import ${packageName!}.excel.${entityKey!}Excel;
import ${superMapperClassPackage!};
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* ${table.comment!} Mapper 接口
*
* @author ${author!}
* @since ${date!}
*/
public interface ${table.mapperName!} extends ${superMapperClass!}<${entityKey!}Entity> {
/**
* 自定义分页
*
* @param page 分页参数
* @param ${entityKeyPath!} 查询参数
* @return List<${entityKey!}VO>
*/
List<${entityKey!}VO> select${entityKey!}Page(IPage page, ${entityKey!}VO ${entityKeyPath!});
/**
* 获取导出数据
*
* @param queryWrapper 查询条件
* @return List<${entityKey!}Excel>
*/
List<${entityKey!}Excel> export${entityKey!}(@Param("ew") Wrapper<${entityKey!}Entity> queryWrapper);
}
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="${package.Mapper!}.${table.mapperName!}">
#if(enableCache){
<!-- 开启二级缓存 -->
<cache type="org.mybatis.caches.ehcache.LoggingEhcache"/>
#}
<!-- 通用查询映射结果 -->
<resultMap id="${entityKeyPath!}ResultMap" type="${package.Entity!}.${entityKey!}Entity">
#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>
<select id="export${entityKey!}" resultType="${packageName!}.excel.${entityKey!}Excel">
SELECT * FROM ${table.name!} \${ew.customSqlSegment}
</select>
</mapper>
@@ -0,0 +1,68 @@
/**
* 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 ${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 com.baomidou.mybatisplus.core.metadata.IPage;
#if(hasSuperEntity){
import ${superServiceClassPackage!};
#}else{
import com.baomidou.mybatisplus.extension.service.IService;
#}
import java.util.List;
/**
* ${table.comment!} 服务类
*
* @author ${author!}
* @since ${date!}
*/
#if(hasSuperEntity){
public interface ${table.serviceName!} extends ${superServiceClass!}<${entity!}> {
#}else{
public interface ${table.serviceName!} extends IService<${entity!}> {
#}
/**
* 自定义分页
*
* @param page 分页参数
* @param ${entityKeyPath!} 查询参数
* @return IPage<${entityKey!}VO>
*/
IPage<${entityKey!}VO> select${entityKey!}Page(IPage<${entityKey!}VO> page, ${entityKey!}VO ${entityKeyPath!});
/**
* 导出数据
*
* @param queryWrapper 查询条件
* @return List<${entityKey!}Excel>
*/
List<${entityKey!}Excel> export${entityKey!}(Wrapper<${entityKey!}Entity> queryWrapper);
}
@@ -0,0 +1,70 @@
/**
* 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 ${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 org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
#if(hasSuperEntity){
import ${superServiceImplClassPackage!};
#}else{
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
#}
import java.util.List;
/**
* ${table.comment!} 服务实现类
*
* @author ${author!}
* @since ${date!}
*/
@Service
#if(hasSuperEntity){
public class ${table.serviceImplName!} extends ${superServiceImplClass!}<${table.mapperName!}, ${entity!}> implements ${table.serviceName!} {
#}else{
public class ${table.serviceImplName!} extends ServiceImpl<${table.mapperName!}, ${entity!}> implements ${table.serviceName!} {
#}
@Override
public IPage<${entityKey!}VO> select${entityKey!}Page(IPage<${entityKey!}VO> page, ${entityKey!}VO ${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);
//${entityKeyPath!}List.forEach(${entityKeyPath!} -> {
// ${entityKeyPath!}.setTypeName(DictCache.getValue(DictEnum.YES_NO, ${entity!}.getType()));
//});
return ${entityKeyPath!}List;
}
}
@@ -0,0 +1,58 @@
/**
* 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 ${strutil.replace(package.Entity,"pojo.entity","wrapper")};
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 java.util.Objects;
/**
* ${table.comment!} 包装类,返回视图层所需的字段
*
* @author ${author!}
* @since ${date!}
*/
public class ${entityKey!}Wrapper extends BaseEntityWrapper<${entityKey!}Entity, ${entityKey!}VO> {
public static ${entityKey!}Wrapper build() {
return new ${entityKey!}Wrapper();
}
@Override
public ${entityKey!}VO entityVO(${entityKey!}Entity ${entityKeyPath!}) {
${entityKey!}VO ${entityKeyPath!}VO = Objects.requireNonNull(BeanUtil.copyProperties(${entityKeyPath!}, ${entityKey!}VO.class));
//User createUser = UserCache.getUser(${entityKeyPath!}.getCreateUser());
//User updateUser = UserCache.getUser(${entityKeyPath!}.getUpdateUser());
//${entityKeyPath!}VO.setCreateUserName(createUser.getName());
//${entityKeyPath!}VO.setUpdateUserName(updateUser.getName());
return ${entityKeyPath!}VO;
}
}
@@ -0,0 +1,5 @@
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