From c1eb0a70dd3362ea94e1b9507e832751ce3ac348 Mon Sep 17 00:00:00 2001
From: qushaowei <qushaowei@163.com>
Date: 星期三, 04 六月 2025 18:36:49 +0800
Subject: [PATCH] 设备台账导出

---
 lxzn-module-eam/src/main/java/org/jeecg/modules/eam/vo/EquipmentExportVo.java                 |  146 +++++++++++++++++++++++++++++
 lxzn-module-eam/src/main/java/org/jeecg/modules/eam/mapper/EamEquipmentMapper.java            |    2 
 lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/EamEquipmentServiceImpl.java |    5 +
 lxzn-module-eam/src/main/java/org/jeecg/modules/eam/mapper/xml/EamEquipmentMapper.xml         |   66 +++++++++++++
 lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/IEamEquipmentService.java         |    2 
 lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/EamEquipmentController.java    |   46 +++++++++
 6 files changed, 267 insertions(+), 0 deletions(-)

diff --git a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/EamEquipmentController.java b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/EamEquipmentController.java
index cb0d4f8..1080626 100644
--- a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/EamEquipmentController.java
+++ b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/EamEquipmentController.java
@@ -22,6 +22,7 @@
 import org.jeecg.common.system.query.QueryGenerator;
 import org.jeecg.common.system.vo.LoginUser;
 import org.jeecg.common.util.DateUtils;
+import org.jeecg.common.util.oConvertUtils;
 import org.jeecg.modules.base.entity.Constructor;
 import org.jeecg.modules.base.service.IConstructorService;
 import org.jeecg.modules.base.service.IFactoryModelService;
@@ -37,13 +38,18 @@
 
 import org.jeecg.common.system.base.controller.JeecgController;
 
+import org.jeecg.modules.eam.vo.EquipmentExportVo;
 import org.jeecg.modules.system.entity.SysDepart;
 import org.jeecg.modules.system.entity.SysUser;
 import org.jeecg.modules.system.service.ISysDepartService;
 import org.jeecg.modules.system.service.ISysUserService;
 import org.jeecgframework.poi.excel.ExcelImportUtil;
+import org.jeecgframework.poi.excel.def.NormalExcelConstants;
+import org.jeecgframework.poi.excel.entity.ExportParams;
 import org.jeecgframework.poi.excel.entity.ImportParams;
+import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.context.annotation.Lazy;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.web.bind.annotation.*;
@@ -130,6 +136,9 @@
 
 	 @Autowired
 	 private ISysUserService sysUserService;
+
+	 @Value("${jeecg.path.upload}")
+	 private String upLoadPath;
 
 
 	/**
@@ -561,6 +570,43 @@
     public ModelAndView exportXls(HttpServletRequest request, Equipment equipment) {
         return super.exportXls(request, equipment, Equipment.class, "璁惧鍙拌处瀵煎嚭");
     }
+	 /**
+	  * 瀵煎嚭excel
+	  *
+	  * @param request
+	  * @param equipment
+	  */
+	 //@RequiresPermissions("org.jeecg.modules.demo:mom_eam_equipment:exportXls")
+	 @RequestMapping(value = "/exportXlsNew")
+	 public ModelAndView exportXlsNew(HttpServletRequest request, Equipment equipment) {
+		 // Step.1 缁勮鏌ヨ鏉′欢
+//		 QueryWrapper<T> queryWrapper = QueryGenerator.initQueryWrapper(object, request.getParameterMap());
+		 LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+
+		 // 杩囨护閫変腑鏁版嵁
+//		 String selections = request.getParameter("selections");
+//		 if (oConvertUtils.isNotEmpty(selections)) {
+//			 List<String> selectionList = Arrays.asList(selections.split(","));
+//			 queryWrapper.in("id",selectionList);
+//		 }
+//		 // Step.2 鑾峰彇瀵煎嚭鏁版嵁
+//		 List<T> exportList = service.list(queryWrapper);
+
+		 List<Map<String, Object>> mapList = equipmentService.exportXlsNew();
+
+		 // Step.3 AutoPoi 瀵煎嚭Excel
+		 ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
+		 //姝ゅ璁剧疆鐨刦ilename鏃犳晥 ,鍓嶇浼氶噸鏇存柊璁剧疆涓�涓�
+		 mv.addObject(NormalExcelConstants.FILE_NAME, "璁惧鍙拌处瀵煎嚭");
+		 mv.addObject(NormalExcelConstants.CLASS, EquipmentExportVo.class);
+		 //update-begin--Author:liusq  Date:20210126 for锛氬浘鐗囧鍑烘姤閿欙紝ImageBasePath鏈缃�--------------------
+		 ExportParams exportParams=new ExportParams("璁惧鍙拌处瀵煎嚭" + "鎶ヨ〃", "瀵煎嚭浜�:" + sysUser.getRealname(), "璁惧鍙拌处瀵煎嚭");
+		 exportParams.setImageBasePath(upLoadPath);
+		 //update-end--Author:liusq  Date:20210126 for锛氬浘鐗囧鍑烘姤閿欙紝ImageBasePath鏈缃�----------------------
+		 mv.addObject(NormalExcelConstants.PARAMS,exportParams);
+		 mv.addObject(NormalExcelConstants.DATA_LIST, mapList);
+		 return mv;
+	 }
 
 //    /**
 //      * 閫氳繃excel瀵煎叆鏁版嵁
diff --git a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/mapper/EamEquipmentMapper.java b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/mapper/EamEquipmentMapper.java
index fd3a99c..0e2e35f 100644
--- a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/mapper/EamEquipmentMapper.java
+++ b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/mapper/EamEquipmentMapper.java
@@ -113,4 +113,6 @@
                                         @Param("sql")String sql
     );
     List<DailyInspectionStandardDetail>  getStandardList(Page<DailyInspectionStandardDetail> page,@Param("mainId") String mainId,@Param("type")String type);
+
+    List<Map<String, Object>> exportXlsNew();
 }
diff --git a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/mapper/xml/EamEquipmentMapper.xml b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/mapper/xml/EamEquipmentMapper.xml
index f4e7413..f81c85d 100644
--- a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/mapper/xml/EamEquipmentMapper.xml
+++ b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/mapper/xml/EamEquipmentMapper.xml
@@ -588,4 +588,70 @@
         ORDER BY t1.create_time desc
     </select>
 
+    <select id="exportXlsNew"  parameterType="Map" resultType="map">
+        SELECT
+            t1.num,
+            t1.name,
+            t2.depart_name AS useDepart,
+            t2.depart_name AS manageDepart,
+            t4.name as workCenter,
+            t5.name as factoryModel,
+            t6.name as area,
+            t7.name as teamName,
+            t8.name as equipmentCategoryName,
+            t9.item_text as equipmentStatus,
+            t10.item_text as technologyStatus,
+            t1.equipment_importance_id as abc,
+            t11.item_text as specificEquipment,
+            t1.security_configuration as securityConfiguration,
+            t12.item_text as coolingSystem,
+            t1.fire_extinguisher as fireExtinguisher,
+            t1.fire_extinguisher_validity_period as fireExtinguisherValidityPeriod,
+            t13.item_text as operatingSystem,
+            t1.system,
+            t1.port,
+            t1.coordinate_num as coordinateNum,
+            t1.equipment_uda3 as equipmentUda3,
+            t1.equipment_uda4 as equipmentUda4,
+            t1.equipment_Uda5 as equipmentUda5,
+            t1.location,
+            CONVERT(VARCHAR(10), t1.leave_factory_date, 120) as leaveFactoryDate,
+            t1.project_approval_no as projectApprovalNo,
+            t1.fund_source as fundSource,
+            CONVERT(VARCHAR(10), t1.acceptance_check_date, 120) as acceptanceCheckDate,
+            t1.factory_number as factoryNumber,
+            t15.name as constructor,
+            t1.source_country as sourceCountry,
+            t1.model as equipmentModel,
+            t1.specification as equpmentSspecification,
+            t1.gpo,
+            t1.warranty_start as warrantyStart,
+            t1.warranty_end as warrantyEnd,
+            t14.item_text as propertyStatus,
+            CONVERT(VARCHAR(10), t1.third_maintenance_time, 120) as thirdMaintenanceTime,
+            CONVERT(VARCHAR(10), t1.next_technology_status_qualification_time, 120) as nextTechnologyStatusQualificationTime,
+            t1.create_by as createBy,
+            CONVERT(VARCHAR(10), t1.create_time, 120) as createTime,
+            t1.update_by as updateBy,
+            CONVERT(VARCHAR(10), t1.update_time, 120) as updateTime
+        FROM
+            mom_eam_equipment t1
+                LEFT JOIN sys_depart t2 ON t1.use_id = t2.id
+                left join sys_depart t3 on t1.manage_id = t3.id
+                left join mom_base_area t4 on t1.work_center_id = t4.id
+                left join mom_base_area t5 on t1.factory_model_id = t5.id
+                left join mom_base_area t6 on t1.area_id = t6.id
+                left join mom_base_team t7 on t1.team_id = t7.id
+                left join mom_eam_equipment_category t8 on t1.equipment_category_id = t8.id
+                left join (SELECT * FROM v_sys_dict WHERE dict_code = 'equipment_status')  t9 on t1.equipment_status = t9.item_value
+                left join (SELECT * FROM v_sys_dict WHERE dict_code = 'technology_status') t10 on t1.technology_status =t10.item_value
+                left join (SELECT * FROM v_sys_dict WHERE dict_code = 'specific_equipment') t11 on t1.specific_equipment = t11.item_value
+                left join (SELECT * FROM v_sys_dict WHERE dict_code = 'cooling_system') t12 on t1.cooling_system = t12.item_value
+                left join (SELECT * FROM v_sys_dict WHERE dict_code = 'operation_flag') t13 on t1.operating_system = t13.item_value
+                left join (SELECT * FROM v_sys_dict WHERE dict_code = 'property_status') t14 on t1.property_status = t14.item_value
+                left join mom_base_constructor t15 on t1.constructor_id = t15.id
+        where t1.del_flag = '0' ORDER BY t1.create_time DESC
+
+    </select>
+
 </mapper>
diff --git a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/IEamEquipmentService.java b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/IEamEquipmentService.java
index 0e71864..21f4eaf 100644
--- a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/IEamEquipmentService.java
+++ b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/IEamEquipmentService.java
@@ -66,4 +66,6 @@
     IPage<DailyInspectionStandardDetail>  getStandardList(Page<DailyInspectionStandardDetail> page, String mainId,String type);
 
     IPage<Map<String, Object>> getEquipmentListAllStandard(Integer pageNo, Integer pageSize, Map<String, Object> params);
+
+    List<Map<String, Object>> exportXlsNew();
 }
diff --git a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/EamEquipmentServiceImpl.java b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/EamEquipmentServiceImpl.java
index db8f866..63ea773 100644
--- a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/EamEquipmentServiceImpl.java
+++ b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/EamEquipmentServiceImpl.java
@@ -195,4 +195,9 @@
         IPage<Map> pageData = new Page<Map>(pageNo, pageSize);
         return super.getBaseMapper().getEquipmentListAllStandard(pageData,params);
     }
+
+    @Override
+    public List<Map<String, Object>> exportXlsNew() {
+        return super.getBaseMapper().exportXlsNew();
+    }
 }
diff --git a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/vo/EquipmentExportVo.java b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/vo/EquipmentExportVo.java
new file mode 100644
index 0000000..d32d1c1
--- /dev/null
+++ b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/vo/EquipmentExportVo.java
@@ -0,0 +1,146 @@
+package org.jeecg.modules.eam.vo;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+import org.jeecgframework.poi.excel.annotation.Excel;
+
+@Data
+@Accessors(chain = true)
+@EqualsAndHashCode(callSuper = false)
+public class EquipmentExportVo {
+
+    @Excel(name = "缁熶竴缂栫爜", width = 15)
+    private String num;
+
+    @Excel(name = "璁惧鍚嶇О", width = 15)
+    private String name;
+
+    @Excel(name = "浣跨敤閮ㄩ棬", width = 15)
+    private String useDepart;
+
+    @Excel(name = "缁存姢閮ㄩ棬", width = 15)
+    private String manageDepart;
+
+    @Excel(name = "涓績", width = 15)
+    private String workCenter;
+
+    @Excel(name = "宸ュ尯", width = 15)
+    private String factoryModel;
+
+    @Excel(name = "宸ユ", width = 15)
+    private String area;
+
+    @Excel(name = "缁翠慨鐝粍", width = 15)
+    private String teamName;
+
+    @Excel(name = "璁惧鎵�灞炲垎绫�", width = 15)
+    private String equipmentCategoryName;
+
+    @Excel(name = "璁惧鐘舵��", width = 15)
+    private String equipmentStatus;
+
+    @Excel(name = "鎶�鏈姸鎬�", width = 15)
+    private String technologyStatus;
+
+    @Excel(name = "ABC鏍囪瘑", width = 15)
+    private String abc;
+
+    @Excel(name = "鍏抽敭璁惧鏍囪瘑", width = 15)
+    private String specificEquipment;
+
+    @Excel(name = "瀹夊叏閰嶇疆", width = 15)
+    private String securityConfiguration;
+
+    @Excel(name = "鍐峰嵈绯荤粺", width = 15)
+    private String coolingSystem;
+
+    @Excel(name = "鐏伀鍣�", width = 15)
+    private String fireExtinguisher;
+
+    @Excel(name = "鐏伀鍣ㄦ湁鏁堟湡", width = 15)
+    private String fireExtinguisherValidityPeriod;
+
+    @Excel(name = "鎿嶄綔绯荤粺", width = 15)
+    private String operatingSystem;
+
+    @Excel(name = "绯荤粺", width = 15)
+    private String system;
+
+    @Excel(name = "璁惧绔彛", width = 15)
+    private String port;
+
+    @Excel(name = "鍧愭爣鏁伴噺", width = 15)
+    private String coordinateNum;
+
+    @Excel(name = "閲嶉噺", width = 15)
+    private String equipmentUda3;
+
+    @Excel(name = "閲嶉噺璁¢噺鍗曚綅", width = 15)
+    private String equipmentUda4;
+
+    @Excel(name = "鍔熻兘浣嶇疆", width = 15)
+    private String equipmentUda5;
+
+    @Excel(name = "瀹夎浣嶇疆", width = 15)
+    private String location;
+
+    @Excel(name = "鍑哄巶鏃ユ湡", width = 15)
+    private String leaveFactoryDate;
+
+    @Excel(name = "绔嬮」鍗″彿", width = 15)
+    private String projectApprovalNo;
+
+    @Excel(name = "璧勯噾鏉ユ簮", width = 15)
+    private String fundSource;
+
+    @Excel(name = "楠屾敹鏃ユ湡", width = 15)
+    private String acceptanceCheckDate;
+
+    @Excel(name = "鍑哄巶缂栧彿", width = 15)
+    private String factoryNumber;
+
+    @Excel(name = "璧勪骇鍒堕�犲晢", width = 15)
+    private String constructor;
+
+    @Excel(name = "璧勪骇鏉ユ簮鍥藉", width = 15)
+    private String sourceCountry;
+
+    @Excel(name = "鍨嬪彿", width = 15)
+    private String equipmentModel;
+
+    @Excel(name = "璁惧瑙勬牸", width = 15)
+    private String equpmentSspecification;
+
+    @Excel(name = "鎬诲姛鐜�", width = 15)
+    private String gpo;
+
+    @Excel(name = "璐ㄤ繚寮�濮嬫棩鏈�", width = 15)
+    private String warrantyStart;
+
+    @Excel(name = "璐ㄤ繚缁撴潫鏃ユ湡", width = 15)
+    private String warrantyEnd;
+
+    @Excel(name = "璧勪骇鐘舵��", width = 15)
+    private String propertyStatus;
+
+    @Excel(name = "涓変繚鏃ユ湡", width = 20)
+    private String thirdMaintenanceTime;
+
+    @Excel(name = "鎶�鏈姸鎬侀壌瀹氭棩鏈�", width = 20)
+    private String nextTechnologyStatusQualificationTime;
+
+    @Excel(name = "鍒涘缓浜�", width = 15)
+    private String createBy;
+
+    @Excel(name = "鍒涘缓鏃堕棿", width = 15)
+    private String createTime;
+
+    @Excel(name = "鏇存柊浜�", width = 15)
+    private String updateBy;
+
+    @Excel(name = "鏇存柊鏃堕棿", width = 15)
+    private String updateTime;
+
+}

--
Gitblit v1.9.3