From 7c22bbe310cc5086bf246ed6bf72e74654028619 Mon Sep 17 00:00:00 2001
From: feige <feige@qq.com>
Date: 星期三, 17 五月 2023 11:35:10 +0800
Subject: [PATCH] 修改了导出接口,可以根据选择的ids进行导出

---
 zhang-content/src/main/java/com/ruoyi/service/impl/ZfEventServiceImpl.java      |   12 ++++++++++++
 zhang-content/src/main/java/com/ruoyi/service/ZfEventService.java               |    1 +
 ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZfEventController.java |    4 ++--
 3 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZfEventController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZfEventController.java
index b65725d..9151187 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZfEventController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZfEventController.java
@@ -65,8 +65,8 @@
 //    @PreAuthorize("@ss.hasPermi('system:property:export')")
     @Log(title = "瀹跺涵澶т簨浠惰褰�", businessType = BusinessType.EXPORT)
     @PostMapping("/export")
-    public void export(HttpServletResponse response, ZfEvent zfEvent) {
-        List<ZfEvent> list = zfEventService.selectByCondition(zfEvent);
+    public void export(HttpServletResponse response, @PathVariable Long[] ids) {
+        List<ZfEvent> list = zfEventService.selectByIds(ids);
         log.info("瀵煎嚭璁板綍涓�:{}", list);
         ExcelUtil<ZfEvent> util = new ExcelUtil<>(ZfEvent.class);
         util.exportExcel(response, list, "瀹跺涵澶т簨浠惰褰曟暟鎹�");
diff --git a/zhang-content/src/main/java/com/ruoyi/service/ZfEventService.java b/zhang-content/src/main/java/com/ruoyi/service/ZfEventService.java
index ed4cf44..1a38063 100644
--- a/zhang-content/src/main/java/com/ruoyi/service/ZfEventService.java
+++ b/zhang-content/src/main/java/com/ruoyi/service/ZfEventService.java
@@ -21,6 +21,7 @@
     AjaxResult selectDataList(ZfEvent zfEvent, Integer pageNum, Integer pageSize);
 
     List<ZfEvent> selectByCondition(ZfEvent zfEvent);
+    List<ZfEvent> selectByIds(Long[] ids);
 
     AjaxResult addData(ZfEvent zfEvent);
 
diff --git a/zhang-content/src/main/java/com/ruoyi/service/impl/ZfEventServiceImpl.java b/zhang-content/src/main/java/com/ruoyi/service/impl/ZfEventServiceImpl.java
index 97d08ef..0a139c9 100644
--- a/zhang-content/src/main/java/com/ruoyi/service/impl/ZfEventServiceImpl.java
+++ b/zhang-content/src/main/java/com/ruoyi/service/impl/ZfEventServiceImpl.java
@@ -24,6 +24,8 @@
 import org.springframework.web.multipart.MultipartFile;
 
 import javax.annotation.Resource;
+import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.HashMap;
 import java.util.List;
 import java.util.stream.Collectors;
@@ -201,6 +203,16 @@
         return markOwnData(familyIds, beanRecords);
     }
 
+    @Override
+    public List<ZfEvent> selectByIds(Long[] ids) {
+        List<ZfEvent> list = new ArrayList<>();
+        if(ids.length!=0)
+            list = listByIds(Arrays.asList(ids));
+        else
+            list = list();
+        return list;
+    }
+
     private static List<ZfEvent> markOwnData(String familyIds, List<ZfEvent> beanRecords) {
         return beanRecords.stream().peek(record -> {
             String recordFamilyId = record.getFamilyId();

--
Gitblit v1.9.1