From fa3428b4bb32179a42d5618357c22fe2695716ae Mon Sep 17 00:00:00 2001
From: chenhj <1263187585@qq.com>
Date: 星期三, 22 四月 2026 13:58:23 +0800
Subject: [PATCH] 修改全局的注入方式
---
src/main/java/com/ruoyi/waterrecord/controller/WaterRecordController.java | 10 +++++++---
1 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/src/main/java/com/ruoyi/waterrecord/controller/WaterRecordController.java b/src/main/java/com/ruoyi/waterrecord/controller/WaterRecordController.java
index 87a9b7d..5ee380b 100644
--- a/src/main/java/com/ruoyi/waterrecord/controller/WaterRecordController.java
+++ b/src/main/java/com/ruoyi/waterrecord/controller/WaterRecordController.java
@@ -11,13 +11,14 @@
import com.ruoyi.waterrecord.service.WaterRecordService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
+import lombok.AllArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
-import javax.servlet.http.HttpServletResponse;
+import jakarta.servlet.http.HttpServletResponse;
import java.util.List;
/**
@@ -27,9 +28,9 @@
@RestController
@Api(tags = "鐢ㄦ按绠$悊")
@RequestMapping("/waterRecord")
+@AllArgsConstructor
public class WaterRecordController extends BaseController {
- @Autowired
private WaterRecordService waterRecordService;
@GetMapping("/listPage")
@@ -81,8 +82,11 @@
@PostMapping("/export")
@ApiOperation("瀵煎嚭鐢ㄦ按绠$悊")
public void export(HttpServletResponse response) {
+ Page page = new Page(-1,-1);
+ WaterRecord waterRecord = new WaterRecord();
+ IPage<WaterRecord> listPage = waterRecordService.listPage(page, waterRecord);
ExcelUtil<WaterRecord> util = new ExcelUtil<WaterRecord>(WaterRecord.class);
- util.exportExcel(response, null , "鐢ㄦ按绠$悊");
+ util.exportExcel(response, listPage.getRecords() , "鐢ㄦ按绠$悊");
}
}
--
Gitblit v1.9.3