From e6b7d6af8f9acf79f32fd386a9cead2d24ae2f9a Mon Sep 17 00:00:00 2001
From: wl <173@qq.com>
Date: 星期五, 30 十二月 2022 15:04:55 +0800
Subject: [PATCH] fix: 栏目订阅

---
 ycl-platform/src/main/java/com/ycl/controller/cockpit/teamConstruction/TeamConstructionController.java |   44 +++++++++++++++++---------------------------
 1 files changed, 17 insertions(+), 27 deletions(-)

diff --git a/ycl-platform/src/main/java/com/ycl/controller/cockpit/teamConstruction/TeamConstructionController.java b/ycl-platform/src/main/java/com/ycl/controller/cockpit/teamConstruction/TeamConstructionController.java
index 2806951..9867d6a 100644
--- a/ycl-platform/src/main/java/com/ycl/controller/cockpit/teamConstruction/TeamConstructionController.java
+++ b/ycl-platform/src/main/java/com/ycl/controller/cockpit/teamConstruction/TeamConstructionController.java
@@ -12,6 +12,7 @@
 import com.ycl.controller.BaseController;
 import com.ycl.entity.cockpitManage.TeamConstruction;
 import com.ycl.service.cockpitManage.ITeamConstructionService;
+import com.ycl.utils.EasyExcelUtils;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiImplicitParam;
 import io.swagger.annotations.ApiImplicitParams;
@@ -24,7 +25,6 @@
 
 import javax.servlet.http.HttpServletResponse;
 import java.time.LocalDateTime;
-import java.time.format.DateTimeFormatter;
 
 /**
  * <p>
@@ -58,27 +58,27 @@
         return CommonResult.success(iTeamConstructionService
                 .page(new Page<TeamConstruction>().setSize(size).setCurrent(current), new LambdaQueryWrapper<TeamConstruction>()
                         .like(StringUtils.isNotBlank(departName), TeamConstruction::getName, departName)
-                        .eq( status != null, TeamConstruction::getStatus, status)
+                        .eq(status != null, TeamConstruction::getStatus, status)
                         .eq(TeamConstruction::getIsDelete, isDelete)));
     }
 
     @PostMapping("/addition")
     @ApiOperation("娣诲姞")
-    @LogSave(operationType = "闃熶紞寤鸿绠$悊",contain = "娣诲姞")
+    @LogSave(operationType = "闃熶紞寤鸿绠$悊", contain = "娣诲姞")
     public CommonResult add(@RequestBody TeamConstruction teamConstruction) {
         return CommonResult.success(iTeamConstructionService.save(teamConstruction));
     }
 
     @PutMapping("/modification")
     @ApiOperation("淇敼")
-    @LogSave(operationType = "闃熶紞寤鸿绠$悊",contain = "淇敼")
+    @LogSave(operationType = "闃熶紞寤鸿绠$悊", contain = "淇敼")
     public CommonResult modify(@RequestBody TeamConstruction teamConstruction) {
         return CommonResult.success(iTeamConstructionService.updateById(teamConstruction));
     }
 
     @DeleteMapping("/deletion")
     @ApiOperation("鍒犻櫎")
-    @LogSave(operationType = "闃熶紞寤鸿绠$悊",contain = "鍒犻櫎")
+    @LogSave(operationType = "闃熶紞寤鸿绠$悊", contain = "鍒犻櫎")
     public CommonResult delete(@RequestParam Long id) {
         Integer isDelete = 1;
         TeamConstruction teamConstruction = new TeamConstruction();
@@ -89,41 +89,31 @@
 
     @PostMapping("/export")
     @ApiOperation("瀵煎嚭")
-    @LogSave(operationType = "闃熶紞寤鸿绠$悊",contain = "瀵煎嚭")
+    @LogSave(operationType = "闃熶紞寤鸿绠$悊", contain = "瀵煎嚭")
     @ApiImplicitParams(
             {
-                    @ApiImplicitParam(name = "size", required = true, value = "椤甸潰鏁伴噺"),
-                    @ApiImplicitParam(name = "current", required = true, value = "椤电爜"),
                     @ApiImplicitParam(name = "departName", value = "閮ㄩ棬鍚嶇О"),
                     @ApiImplicitParam(name = "status", value = "鐘舵��")}
     )
     @SneakyThrows
-    public void export(@RequestParam() Integer size,
-                       @RequestParam() Integer current,
-                       @RequestParam(name = "departName", required = false) String departName,
-                       @RequestParam(name = "status", required = false) Integer status,
-                       HttpServletResponse response) {
+    public void export(
+            @RequestParam(name = "departName", required = false) String departName,
+            @RequestParam(name = "status", required = false) Integer status,
+            HttpServletResponse response) {
         Integer isDelete = 0;
-        response.setContentType("application/vnd.ms-excel");
-        response.setCharacterEncoding("utf-8");
-        response.setHeader("Content-disposition", "attachment;filename=" + LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")) + ".xlsx");
-        EasyExcel
-                .write(response.getOutputStream(), TeamConstruction.class)
-                .sheet("鏁版嵁")
-                .doWrite(iTeamConstructionService
-                        .page(new Page<TeamConstruction>().setSize(size).setCurrent(current), new LambdaQueryWrapper<TeamConstruction>()
-                                .like(StringUtils.isNotBlank(departName), TeamConstruction::getName, departName)
-                                .eq(status != null, TeamConstruction::getStatus, status)
-                                .eq(TeamConstruction::getIsDelete, isDelete))
-                        .getRecords());
-
+        String sheetName = "鏁版嵁";
+        EasyExcelUtils.export(response, sheetName, TeamConstruction.class, iTeamConstructionService
+                .list(new LambdaQueryWrapper<TeamConstruction>()
+                        .like(StringUtils.isNotBlank(departName), TeamConstruction::getName, departName)
+                        .eq(status != null, TeamConstruction::getStatus, status)
+                        .eq(TeamConstruction::getIsDelete, isDelete)));
     }
 
 
     @PostMapping("/import")
     @ApiOperation("瀵煎叆")
     @SneakyThrows
-    @LogSave(operationType = "闃熶紞寤鸿绠$悊",contain = "瀵煎叆")
+    @LogSave(operationType = "闃熶紞寤鸿绠$悊", contain = "瀵煎叆")
     public CommonResult export(MultipartFile multipartFile) {
         EasyExcel.read(multipartFile.getInputStream(), TeamConstruction.class, new ReadListener() {
             @Override

--
Gitblit v1.8.0