From 3a0087aa5e3eed5d9d7a793a17dc01fd1d6df80c Mon Sep 17 00:00:00 2001
From: huang <1532065656@qq.com>
Date: 星期四, 17 四月 2025 17:01:15 +0800
Subject: [PATCH] 看板大屏2修改页面

---
 JiuMuMesParent/moduleService/DeviceInteractionModule/src/main/java/com/mes/yield/controller/YieldController.java |   14 +++++++++++++-
 1 files changed, 13 insertions(+), 1 deletions(-)

diff --git a/JiuMuMesParent/moduleService/DeviceInteractionModule/src/main/java/com/mes/yield/controller/YieldController.java b/JiuMuMesParent/moduleService/DeviceInteractionModule/src/main/java/com/mes/yield/controller/YieldController.java
index 6c19874..935edd1 100644
--- a/JiuMuMesParent/moduleService/DeviceInteractionModule/src/main/java/com/mes/yield/controller/YieldController.java
+++ b/JiuMuMesParent/moduleService/DeviceInteractionModule/src/main/java/com/mes/yield/controller/YieldController.java
@@ -11,6 +11,7 @@
 import org.springframework.web.bind.annotation.*;
 import org.springframework.util.StringUtils;
 
+import java.util.Calendar;
 import java.util.Date;
 import java.util.List;
 import java.util.Map;
@@ -82,12 +83,23 @@
     @ResponseBody
     public Result getChartData(@RequestBody(required = false) Map<String, Object> params) {
         String lineNo = params != null ? (String) params.get("lineNo") : null;
+        Integer dayCount = params != null && params.get("dayCount") != null ? (Integer) params.get("dayCount") : null;
         
         QueryWrapper<Yield> queryWrapper = new QueryWrapper<Yield>().orderByAsc("record_time");
         if (StringUtils.hasText(lineNo)) {
             queryWrapper.eq("line_no", lineNo);
         }
-        queryWrapper.last("limit 30");
+        
+        // 濡傛灉鎸囧畾浜嗗ぉ鏁帮紝鍒欐煡璇㈡渶杩慛澶╃殑鏁版嵁锛屽惁鍒欐煡璇㈠叏閮ㄦ暟鎹�
+        if (dayCount != null && dayCount > 0) {
+            // 璁$畻N澶╁墠鐨勬棩鏈�
+            Calendar calendar = Calendar.getInstance();
+            calendar.add(Calendar.DAY_OF_MONTH, -dayCount);
+            Date startDate = calendar.getTime();
+            queryWrapper.ge("record_time", startDate);
+        }
+        
+        // 绉婚櫎浜嗗浐瀹歭imit闄愬埗锛屽厑璁歌幏鍙栧叏閮ㄦ暟鎹�
         
         List<Yield> data = yieldService.list(queryWrapper);
         

--
Gitblit v1.8.0