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:
+5
-3
@@ -12,7 +12,7 @@ import org.dromara.common.redis.annotation.RepeatSubmit;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import org.dromara.common.core.domain.PageResult;
|
||||
import org.dromara.common.excel.core.ExcelResult;
|
||||
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.demo.domain.TestDemo;
|
||||
@@ -74,7 +74,9 @@ public class TestDemoController extends BaseController {
|
||||
@SaCheckPermission("demo:demo:import")
|
||||
@PostMapping(value = "/importData", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
|
||||
public R<Void> importData(@RequestPart("file") MultipartFile file) throws Exception {
|
||||
ExcelResult<TestDemoImportVo> excelResult = ExcelUtil.importExcel(file.getInputStream(), TestDemoImportVo.class, true);
|
||||
ExcelResult<TestDemoImportVo> excelResult = ExcelBuilder.read(file.getInputStream(), TestDemoImportVo.class)
|
||||
.validate(true)
|
||||
.doRead();
|
||||
List<TestDemo> list = MapstructUtils.convert(excelResult.getList(), TestDemo.class);
|
||||
testDemoService.saveBatch(list);
|
||||
return R.ok(excelResult.getAnalysis());
|
||||
@@ -92,7 +94,7 @@ public class TestDemoController extends BaseController {
|
||||
// for (TestDemoVo vo : list) {
|
||||
// vo.setId(1234567891234567893L);
|
||||
// }
|
||||
ExcelUtil.exportExcel(list, "测试单表", TestDemoVo.class, response);
|
||||
ExcelBuilder.of(list, TestDemoVo.class).sheetName("测试单表").toResponse(response);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+17
-7
@@ -6,7 +6,7 @@ import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.dromara.common.excel.core.ExcelResult;
|
||||
import org.dromara.common.excel.utils.ExcelUtil;
|
||||
import org.dromara.common.excel.utils.ExcelBuilder;
|
||||
import org.dromara.demo.domain.vo.ExportDemoVo;
|
||||
import org.dromara.demo.listener.ExportDemoListener;
|
||||
import org.dromara.demo.service.IExportExcelService;
|
||||
@@ -14,7 +14,6 @@ import org.springframework.http.MediaType;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
@@ -48,7 +47,10 @@ public class TestExcelController {
|
||||
list.add(new TestObj("单列表测试1", "列表测试1", "列表测试2", "列表测试3", "列表测试4"));
|
||||
list.add(new TestObj("单列表测试2", "列表测试5", "列表测试6", "列表测试7", "列表测试8"));
|
||||
list.add(new TestObj("单列表测试3", "列表测试9", "列表测试10", "列表测试11", "列表测试12"));
|
||||
ExcelUtil.exportTemplate(CollUtil.newArrayList(map, list), "单列表.xlsx", "excel/单列表.xlsx", response);
|
||||
ExcelBuilder.template("excel/单列表.xlsx")
|
||||
.filename("单列表.xlsx")
|
||||
.data(CollUtil.newArrayList(map, list))
|
||||
.toResponse(response);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -82,7 +84,10 @@ public class TestExcelController {
|
||||
multiListMap.put("data2", list2);
|
||||
multiListMap.put("data3", list3);
|
||||
multiListMap.put("data4", list4);
|
||||
ExcelUtil.exportTemplateMultiList(multiListMap, "多列表.xlsx", "excel/多列表.xlsx", response);
|
||||
ExcelBuilder.template("excel/多列表.xlsx")
|
||||
.filename("多列表.xlsx")
|
||||
.multiList(multiListMap)
|
||||
.toResponse(response);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -101,7 +106,7 @@ public class TestExcelController {
|
||||
* @param response /
|
||||
*/
|
||||
@GetMapping("/customExport")
|
||||
public void customExport(HttpServletResponse response) throws IOException {
|
||||
public void customExport(HttpServletResponse response) {
|
||||
exportExcelService.customExport(response);
|
||||
}
|
||||
|
||||
@@ -137,7 +142,10 @@ public class TestExcelController {
|
||||
list.add(sheetMap2);
|
||||
list.add(sheetMap3);
|
||||
list.add(sheetMap4);
|
||||
ExcelUtil.exportTemplateMultiSheet(list, "多sheet列表", "excel/多sheet列表.xlsx", response);
|
||||
ExcelBuilder.template("excel/多sheet列表.xlsx")
|
||||
.filename("多sheet列表")
|
||||
.multiSheet(list)
|
||||
.toResponse(response);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -146,7 +154,9 @@ public class TestExcelController {
|
||||
@PostMapping(value = "/importWithOptions", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
|
||||
public List<ExportDemoVo> importWithOptions(@RequestPart("file") MultipartFile file) throws Exception {
|
||||
// 处理解析结果
|
||||
ExcelResult<ExportDemoVo> excelResult = ExcelUtil.importExcel(file.getInputStream(), ExportDemoVo.class, new ExportDemoListener());
|
||||
ExcelResult<ExportDemoVo> excelResult = ExcelBuilder.read(file.getInputStream(), ExportDemoVo.class)
|
||||
.listener(new ExportDemoListener())
|
||||
.doRead();
|
||||
return excelResult.getList();
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -6,7 +6,7 @@ import org.dromara.common.core.validate.AddGroup;
|
||||
import org.dromara.common.core.validate.EditGroup;
|
||||
import org.dromara.common.core.validate.QueryGroup;
|
||||
import org.dromara.common.web.core.BaseController;
|
||||
import org.dromara.common.excel.utils.ExcelUtil;
|
||||
import org.dromara.common.excel.utils.ExcelBuilder;
|
||||
import org.dromara.common.redis.annotation.RepeatSubmit;
|
||||
import org.dromara.common.log.annotation.Log;
|
||||
import org.dromara.common.log.enums.BusinessType;
|
||||
@@ -55,7 +55,7 @@ public class TestTreeController extends BaseController {
|
||||
@GetMapping("/export")
|
||||
public void export(@Validated TestTreeBo bo, HttpServletResponse response) {
|
||||
List<TestTreeVo> list = testTreeService.queryList(bo);
|
||||
ExcelUtil.exportExcel(list, "测试树表", TestTreeVo.class, response);
|
||||
ExcelBuilder.of(list, TestTreeVo.class).sheetName("测试树表").toResponse(response);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+1
-3
@@ -2,8 +2,6 @@ package org.dromara.demo.service;
|
||||
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* 导出下拉框Excel示例
|
||||
*
|
||||
@@ -23,5 +21,5 @@ public interface IExportExcelService {
|
||||
*
|
||||
* @param response /
|
||||
*/
|
||||
void customExport(HttpServletResponse response) throws IOException;
|
||||
void customExport(HttpServletResponse response);
|
||||
}
|
||||
|
||||
+7
-10
@@ -8,15 +8,13 @@ import lombok.Data;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.dromara.common.core.constant.SystemConstants;
|
||||
import org.dromara.common.core.utils.StreamUtils;
|
||||
import org.dromara.common.core.utils.file.FileUtils;
|
||||
import org.dromara.common.excel.core.DropDownOptions;
|
||||
import org.dromara.common.excel.utils.ExcelUtil;
|
||||
import org.dromara.common.excel.utils.ExcelBuilder;
|
||||
import org.dromara.common.excel.utils.ExcelWriterWrapper;
|
||||
import org.dromara.demo.domain.vo.ExportDemoVo;
|
||||
import org.dromara.demo.service.IExportExcelService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -103,7 +101,10 @@ public class ExportExcelServiceImpl implements IExportExcelService {
|
||||
return everyRowData;
|
||||
});
|
||||
|
||||
ExcelUtil.exportExcel(outList, "下拉框示例", ExportDemoVo.class, response, options);
|
||||
ExcelBuilder.of(outList, ExportDemoVo.class)
|
||||
.sheetName("下拉框示例")
|
||||
.options(options)
|
||||
.toResponse(response);
|
||||
}
|
||||
|
||||
private String buildOptions(List<DemoCityData> cityDataList, Integer id) {
|
||||
@@ -240,12 +241,8 @@ public class ExportExcelServiceImpl implements IExportExcelService {
|
||||
|
||||
|
||||
@Override
|
||||
public void customExport(HttpServletResponse response) throws IOException {
|
||||
String filename = ExcelUtil.encodingFilename("自定义导出");
|
||||
FileUtils.setAttachmentResponseHeader(response, filename);
|
||||
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=UTF-8");
|
||||
|
||||
ExcelUtil.exportExcel(ExportDemoVo.class, response.getOutputStream(), wrapper -> {
|
||||
public void customExport(HttpServletResponse response) {
|
||||
ExcelBuilder.writer(ExportDemoVo.class).sheetName("自定义导出").toResponse(response, wrapper -> {
|
||||
// 创建表格数据,业务中一般通过数据库查询
|
||||
List<ExportDemoVo> excelDataList = new ArrayList<>();
|
||||
for (int i = 0; i < 30; i++) {
|
||||
|
||||
@@ -19,7 +19,7 @@ import org.dromara.common.core.validate.AddGroup;
|
||||
import org.dromara.common.core.validate.EditGroup;
|
||||
import org.dromara.common.log.enums.BusinessType;
|
||||
#if($enableExport)
|
||||
import org.dromara.common.excel.utils.ExcelUtil;
|
||||
import org.dromara.common.excel.utils.ExcelBuilder;
|
||||
#end
|
||||
import ${packageName}.domain.vo.${ClassName}Vo;
|
||||
import ${packageName}.domain.bo.${ClassName}Bo;
|
||||
@@ -68,7 +68,7 @@ public class ${ClassName}Controller extends BaseController {
|
||||
@PostMapping("/export")
|
||||
public void export(${ClassName}Bo bo, HttpServletResponse response) {
|
||||
List<${ClassName}Vo> list = ${className}Service.queryList(bo);
|
||||
ExcelUtil.exportExcel(list, "${functionName}", ${ClassName}Vo.class, response);
|
||||
ExcelBuilder.of(list, ${ClassName}Vo.class).sheetName("${functionName}").toResponse(response);
|
||||
}
|
||||
#end
|
||||
|
||||
|
||||
+2
-2
@@ -7,7 +7,7 @@ import lombok.RequiredArgsConstructor;
|
||||
import org.dromara.common.core.constant.CacheNames;
|
||||
import org.dromara.common.core.domain.PageResult;
|
||||
import org.dromara.common.core.domain.R;
|
||||
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;
|
||||
@@ -59,7 +59,7 @@ public class SysLoginInfoController extends BaseController {
|
||||
@PostMapping("/export")
|
||||
public void export(SysLoginInfoBo loginInfo, HttpServletResponse response) {
|
||||
List<SysLoginInfoVo> list = loginInfoService.selectLoginInfoList(loginInfo);
|
||||
ExcelUtil.exportExcel(list, "登录日志", SysLoginInfoVo.class, response);
|
||||
ExcelBuilder.of(list, SysLoginInfoVo.class).sheetName("登录日志").toResponse(response);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+2
-2
@@ -6,7 +6,7 @@ import jakarta.servlet.http.HttpServletResponse;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.dromara.common.core.domain.PageResult;
|
||||
import org.dromara.common.core.domain.R;
|
||||
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;
|
||||
@@ -56,7 +56,7 @@ public class SysOperlogController extends BaseController {
|
||||
@PostMapping("/export")
|
||||
public void export(SysOperLogBo operLog, HttpServletResponse response) {
|
||||
List<SysOperLogVo> list = operLogService.selectOperLogList(operLog);
|
||||
ExcelUtil.exportExcel(list, "操作日志", SysOperLogVo.class, response);
|
||||
ExcelBuilder.of(list, SysOperLogVo.class).sheetName("操作日志").toResponse(response);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+2
-2
@@ -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;
|
||||
@@ -61,7 +61,7 @@ public class SysClientController extends BaseController {
|
||||
@PostMapping("/export")
|
||||
public void export(SysClientBo bo, HttpServletResponse response) {
|
||||
List<SysClientVo> list = sysClientService.queryList(bo);
|
||||
ExcelUtil.exportExcel(list, "客户端管理", SysClientVo.class, response);
|
||||
ExcelBuilder.of(list, SysClientVo.class).sheetName("客户端管理").toResponse(response);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+2
-2
@@ -5,7 +5,7 @@ import jakarta.servlet.http.HttpServletResponse;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.dromara.common.core.domain.PageResult;
|
||||
import org.dromara.common.core.domain.R;
|
||||
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;
|
||||
@@ -57,7 +57,7 @@ public class SysConfigController extends BaseController {
|
||||
@PostMapping("/export")
|
||||
public void export(SysConfigBo config, HttpServletResponse response) {
|
||||
List<SysConfigVo> list = configService.selectConfigList(config);
|
||||
ExcelUtil.exportExcel(list, "参数数据", SysConfigVo.class, response);
|
||||
ExcelBuilder.of(list, SysConfigVo.class).sheetName("参数数据").toResponse(response);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+2
-2
@@ -6,7 +6,7 @@ import jakarta.servlet.http.HttpServletResponse;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.dromara.common.core.domain.PageResult;
|
||||
import org.dromara.common.core.domain.R;
|
||||
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;
|
||||
@@ -61,7 +61,7 @@ public class SysDictDataController extends BaseController {
|
||||
@PostMapping("/export")
|
||||
public void export(SysDictDataBo dictData, HttpServletResponse response) {
|
||||
List<SysDictDataVo> list = dictDataService.selectDictDataList(dictData);
|
||||
ExcelUtil.exportExcel(list, "字典数据", SysDictDataVo.class, response);
|
||||
ExcelBuilder.of(list, SysDictDataVo.class).sheetName("字典数据").toResponse(response);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+2
-2
@@ -6,7 +6,7 @@ import jakarta.servlet.http.HttpServletResponse;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.dromara.common.core.domain.PageResult;
|
||||
import org.dromara.common.core.domain.R;
|
||||
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;
|
||||
@@ -58,7 +58,7 @@ public class SysDictTypeController extends BaseController {
|
||||
@PostMapping("/export")
|
||||
public void export(SysDictTypeBo dictType, HttpServletResponse response) {
|
||||
List<SysDictTypeVo> list = dictTypeService.selectDictTypeList(dictType);
|
||||
ExcelUtil.exportExcel(list, "字典类型", SysDictTypeVo.class, response);
|
||||
ExcelBuilder.of(list, SysDictTypeVo.class).sheetName("字典类型").toResponse(response);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+2
-2
@@ -8,7 +8,7 @@ import lombok.RequiredArgsConstructor;
|
||||
import org.dromara.common.core.constant.SystemConstants;
|
||||
import org.dromara.common.core.domain.PageResult;
|
||||
import org.dromara.common.core.domain.R;
|
||||
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 SysPostController extends BaseController {
|
||||
@PostMapping("/export")
|
||||
public void export(SysPostBo post, HttpServletResponse response) {
|
||||
List<SysPostVo> list = postService.selectPostList(post);
|
||||
ExcelUtil.exportExcel(list, "岗位数据", SysPostVo.class, response);
|
||||
ExcelBuilder.of(list, SysPostVo.class).sheetName("岗位数据").toResponse(response);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+2
-2
@@ -6,7 +6,7 @@ import jakarta.servlet.http.HttpServletResponse;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.dromara.common.core.domain.PageResult;
|
||||
import org.dromara.common.core.domain.R;
|
||||
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;
|
||||
@@ -66,7 +66,7 @@ public class SysRoleController extends BaseController {
|
||||
@PostMapping("/export")
|
||||
public void export(SysRoleBo role, HttpServletResponse response) {
|
||||
List<SysRoleVo> list = roleService.selectRoleList(role);
|
||||
ExcelUtil.exportExcel(list, "角色数据", SysRoleVo.class, response);
|
||||
ExcelBuilder.of(list, SysRoleVo.class).sheetName("角色数据").toResponse(response);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+6
-4
@@ -16,7 +16,7 @@ import org.dromara.common.core.utils.StreamUtils;
|
||||
import org.dromara.common.core.utils.StringUtils;
|
||||
import org.dromara.common.encrypt.annotation.ApiEncrypt;
|
||||
import org.dromara.common.excel.core.ExcelResult;
|
||||
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;
|
||||
@@ -84,7 +84,7 @@ public class SysUserController extends BaseController {
|
||||
@PostMapping("/export")
|
||||
public void export(SysUserBo user, HttpServletResponse response) {
|
||||
List<SysUserExportVo> list = userService.selectUserExportList(user);
|
||||
ExcelUtil.exportExcel(list, "用户数据", SysUserExportVo.class, response);
|
||||
ExcelBuilder.of(list, SysUserExportVo.class).sheetName("用户数据").toResponse(response);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -97,7 +97,9 @@ public class SysUserController extends BaseController {
|
||||
@SaCheckPermission("system:user:import")
|
||||
@PostMapping(value = "/importData", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
|
||||
public R<Void> importData(@RequestPart("file") MultipartFile file, boolean updateSupport) throws Exception {
|
||||
ExcelResult<SysUserImportVo> result = ExcelUtil.importExcel(file.getInputStream(), SysUserImportVo.class, new SysUserImportListener(updateSupport));
|
||||
ExcelResult<SysUserImportVo> result = ExcelBuilder.read(file.getInputStream(), SysUserImportVo.class)
|
||||
.listener(new SysUserImportListener(updateSupport))
|
||||
.doRead();
|
||||
return R.ok(result.getAnalysis());
|
||||
}
|
||||
|
||||
@@ -108,7 +110,7 @@ public class SysUserController extends BaseController {
|
||||
*/
|
||||
@PostMapping("/importTemplate")
|
||||
public void importTemplate(HttpServletResponse response) {
|
||||
ExcelUtil.exportExcel(new ArrayList<>(), "用户数据", SysUserImportVo.class, response);
|
||||
ExcelBuilder.of(new ArrayList<>(), SysUserImportVo.class).sheetName("用户数据").toResponse(response);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+2
-2
@@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+2
-2
@@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user