refactor(common-excel): 重构 Excel 导入导出构建器

- 删除 ExcelUtil,统一由 ExcelBuilder 承载导入、导出、模板导出、ZIP 导出和自定义写出能力
  - 新增 ExcelBuilder.read(...) 导入构建器,支持 validate、failFast、listener、sheet、密码、空行、表头行、trim/strip、限制读取行数等配置
  - 扩展导出构建器,支持动态列、sheet 编号、导出密码、表头控制、固定列宽/行高、自定义 Converter 和 WriteHandler
  - 将业务代码中的 ExcelUtil 调用全部替换为 ExcelBuilder 链式调用
  - 同步调整代码生成器 controller 模板,后续生成代码默认使用 ExcelBuilder
  - 将文件名编码、响应头处理、字典表达式转换收敛为内部实现细节
This commit is contained in:
疯狂的狮子Li
2026-05-16 13:56:35 +08:00
parent 475618e960
commit 7b66f0de26
25 changed files with 1109 additions and 724 deletions
@@ -8,7 +8,7 @@ import lombok.RequiredArgsConstructor;
import org.dromara.common.core.domain.R;
import org.dromara.common.core.validate.AddGroup;
import org.dromara.common.core.validate.EditGroup;
import org.dromara.common.excel.utils.ExcelUtil;
import org.dromara.common.excel.utils.ExcelBuilder;
import org.dromara.common.log.annotation.Log;
import org.dromara.common.log.enums.BusinessType;
import org.dromara.common.redis.annotation.RepeatSubmit;
@@ -61,7 +61,7 @@ public class FlwCategoryController extends BaseController {
@PostMapping("/export")
public void export(FlowCategoryBo bo, HttpServletResponse response) {
List<FlowCategoryVo> list = flwCategoryService.queryList(bo);
ExcelUtil.exportExcel(list, "流程分类", FlowCategoryVo.class, response);
ExcelBuilder.of(list, FlowCategoryVo.class).sheetName("流程分类").toResponse(response);
}
/**
@@ -9,7 +9,7 @@ import org.dromara.common.core.domain.PageResult;
import org.dromara.common.core.domain.R;
import org.dromara.common.core.validate.AddGroup;
import org.dromara.common.core.validate.EditGroup;
import org.dromara.common.excel.utils.ExcelUtil;
import org.dromara.common.excel.utils.ExcelBuilder;
import org.dromara.common.log.annotation.Log;
import org.dromara.common.log.enums.BusinessType;
import org.dromara.common.mybatis.core.page.PageQuery;
@@ -64,7 +64,7 @@ public class TestLeaveController extends BaseController {
@PostMapping("/export")
public void export(TestLeaveBo bo, HttpServletResponse response) {
List<TestLeaveVo> list = testLeaveService.queryList(bo);
ExcelUtil.exportExcel(list, "请假", TestLeaveVo.class, response);
ExcelBuilder.of(list, TestLeaveVo.class).sheetName("请假").toResponse(response);
}
/**