From 9cc00de219965372f23708fa08d04347745668f9 Mon Sep 17 00:00:00 2001
From: qushaowei <qushaowei@163.com>
Date: 星期三, 31 一月 2024 17:51:48 +0800
Subject: [PATCH] Merge branch 'master' of http://117.34.109.166:18448/r/mdc_430 into develop

---
 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcEquipmentController.java |   26 +++++++++++++++++++++++++-
 1 files changed, 25 insertions(+), 1 deletions(-)

diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcEquipmentController.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcEquipmentController.java
index 51c41a8..9ff87ae 100644
--- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcEquipmentController.java
+++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcEquipmentController.java
@@ -23,6 +23,9 @@
 import org.jeecg.modules.mdc.vo.MdcEquipmentVo;
 import org.jeecg.modules.system.model.DepartIdModel;
 import org.jeecg.modules.system.model.ProductionIdModel;
+import org.jeecgframework.poi.excel.def.NormalExcelConstants;
+import org.jeecgframework.poi.excel.entity.ExportParams;
+import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.servlet.ModelAndView;
 
@@ -424,7 +427,28 @@
      */
     @RequestMapping(value = "/exportXls")
     public ModelAndView exportXls(HttpServletRequest request, MdcEquipment mdcEquipment) {
-        return super.exportXls(request, mdcEquipment, MdcEquipment.class, "璁惧琛�");
+        // Step.1 缁勮鏌ヨ鏉′欢
+        //QueryWrapper<MdcEquipment> queryWrapper = QueryGenerator.initQueryWrapper(mdcEquipment, request.getParameterMap());
+        //Step.2 AutoPoi 瀵煎嚭Excel
+        ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
+        List<MdcEquipment> pageList = mdcEquipmentService.exportXlsList(mdcEquipment);
+        List<String> equipmentIds = pageList.stream().map(MdcEquipment::getId).collect(Collectors.toList());
+        if (!equipmentIds.isEmpty()) {
+            Map<String, String> equDepNames = mdcEquipmentService.getDepNamesByEquipmentIds(equipmentIds);
+            Map<String, String> equProNames = mdcEquipmentService.getProNamesByEquipmentIds(equipmentIds);
+            pageList.forEach(item -> {
+                item.setOrgCodeTxt(equDepNames.get(item.getId()));
+                item.setProductionName(equProNames.get(item.getId()));
+            });
+        }
+        mv.addObject(NormalExcelConstants.FILE_NAME, "璁惧鍒楄〃");
+        mv.addObject(NormalExcelConstants.CLASS, MdcEquipment.class);
+        LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+        ExportParams exportParams = new ExportParams("璁惧鍒楄〃鏁版嵁", "瀵煎嚭浜�:" + user.getRealname(), "瀵煎嚭淇℃伅");
+//        exportParams.setImageBasePath(upLoadPath);
+        mv.addObject(NormalExcelConstants.PARAMS, exportParams);
+        mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
+        return mv;
     }
 
     /**

--
Gitblit v1.9.3