From 6dcfb630f22303f622894ab88c4bde06c6a005b8 Mon Sep 17 00:00:00 2001
From: chenlu <1320612696@qq.com>
Date: 星期二, 06 五月 2025 14:29:43 +0800
Subject: [PATCH] 报工管理查询优化

---
 north-glass-erp/src/main/java/com/example/erp/service/pp/ReportingWorkService.java  |    4 ++--
 north-glass-erp/northglass-erp/src/views/pp/reportingWorks/SelectReportingWorks.vue |    8 ++++----
 north-glass-erp/src/main/java/com/example/erp/mapper/pp/ReportingWorkMapper.java    |    2 +-
 north-glass-erp/src/main/resources/mapper/pp/ReportingWork.xml                      |    6 ++++--
 4 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/north-glass-erp/northglass-erp/src/views/pp/reportingWorks/SelectReportingWorks.vue b/north-glass-erp/northglass-erp/src/views/pp/reportingWorks/SelectReportingWorks.vue
index 71f17f3..8967e25 100644
--- a/north-glass-erp/northglass-erp/src/views/pp/reportingWorks/SelectReportingWorks.vue
+++ b/north-glass-erp/northglass-erp/src/views/pp/reportingWorks/SelectReportingWorks.vue
@@ -125,7 +125,7 @@
     total.dataTotal = res.data.total.total*1
     total.pageTotal= res.data.total.pageTotal
     pageTotal.value = res.data.total
-    total.value = res.data.footSum
+    total.value = res.data.total
     produceList = produceList.value.concat(deepClone(res.data.data))
     // 浣跨敤map鏂规硶鏉ュ鐞嗘瘡涓璞�
     let modifiedCollection = produceList.map(item => {
@@ -164,7 +164,7 @@
   let newEndTime = date.toISOString().split('T')[0]; // 鑾峰彇 YYYY-MM-DD 鏍煎紡鐨勫瓧绗︿覆
   request.post(`/reportingWork/selectReportingWork/${pageNum.value}/${total.pageSize}/${startTime}/${newEndTime}/${inputVal}`,filterData.value).then((res) => {
     if(res.code==200){
-      total.value = res.data.footSum
+      total.value = res.data.total
 
       produceList = deepClone(res.data.data)
       // 浣跨敤map鏂规硶鏉ュ鐞嗘瘡涓璞�
@@ -208,7 +208,7 @@
       total.dataTotal = res.data.total.total*1
       total.pageTotal= res.data.total.pageTotal
       pageTotal.value = res.data.total
-      total.value = res.data.footSum
+      total.value = res.data.total
       produceList=res.data.data
       // 浣跨敤map鏂规硶鏉ュ鐞嗘瘡涓璞�
       let modifiedCollection = produceList.map(item => {
@@ -274,7 +274,7 @@
       total.dataTotal = res.data.total.total*1
       total.pageTotal=parseInt(res.data.total)
       pageNum.value=1
-      total.value = res.data.footSum
+      total.value = res.data.total
       produceList = deepClone(res.data.data)
       // 浣跨敤map鏂规硶鏉ュ鐞嗘瘡涓璞�
       let modifiedCollection = produceList.map(item => {
diff --git a/north-glass-erp/src/main/java/com/example/erp/mapper/pp/ReportingWorkMapper.java b/north-glass-erp/src/main/java/com/example/erp/mapper/pp/ReportingWorkMapper.java
index 64d0bbd..45f14aa 100644
--- a/north-glass-erp/src/main/java/com/example/erp/mapper/pp/ReportingWorkMapper.java
+++ b/north-glass-erp/src/main/java/com/example/erp/mapper/pp/ReportingWorkMapper.java
@@ -101,7 +101,7 @@
 
     String selectOrderid(String processIdStr);
 
-    Map<String,Float> getFootSum(Date selectTime1, Date selectTime2, String orderId, ReportingWork reportingWork);
+    Map<String,Float> getFootSum(Integer offset, Integer pageSize, Date selectTime1, Date selectTime2, String orderId, ReportingWork reportingWork);
 
     Integer selectReviewedState(String reportingWorkId);
 
diff --git a/north-glass-erp/src/main/java/com/example/erp/service/pp/ReportingWorkService.java b/north-glass-erp/src/main/java/com/example/erp/service/pp/ReportingWorkService.java
index 14c1e58..b544c7a 100644
--- a/north-glass-erp/src/main/java/com/example/erp/service/pp/ReportingWorkService.java
+++ b/north-glass-erp/src/main/java/com/example/erp/service/pp/ReportingWorkService.java
@@ -577,8 +577,8 @@
         }
         Map<String, Object> map = new HashMap<>();
         map.put("data", reportingWorkMapper.selectReportingWorkMp(offset, pageSize, selectTime1, selectTime2, orderId, reportingWork));
-        map.put("total", reportingWorkMapper.getPageTotal(offset, pageSize, selectTime1, selectTime2, orderId, reportingWork));
-        map.put("footSum" ,reportingWorkMapper.getFootSum(selectTime1, selectTime2, orderId,reportingWork));
+       // map.put("total", reportingWorkMapper.getPageTotal(offset, pageSize, selectTime1, selectTime2, orderId, reportingWork));
+        map.put("total" ,reportingWorkMapper.getFootSum(offset, pageSize, selectTime1, selectTime2, orderId, reportingWork));
         return map;
     }
 
diff --git a/north-glass-erp/src/main/resources/mapper/pp/ReportingWork.xml b/north-glass-erp/src/main/resources/mapper/pp/ReportingWork.xml
index 554d133..da286ba 100644
--- a/north-glass-erp/src/main/resources/mapper/pp/ReportingWork.xml
+++ b/north-glass-erp/src/main/resources/mapper/pp/ReportingWork.xml
@@ -1023,7 +1023,9 @@
         SUM(rwd.completed_quantity) AS thisCompletedQuantity,
         ROUND(SUM(ogd.child_width * ogd.child_height * rwd.completed_quantity / 1000000), 2) AS completedArea,
         SUM(rwd.breakage_quantity) AS thisWornQuantity,
-        ROUND(SUM(ogd.child_width * ogd.child_height * rwd.breakage_quantity / 1000000), 2) AS wornArea
+        ROUND(SUM(ogd.child_width * ogd.child_height * rwd.breakage_quantity / 1000000), 2) AS wornArea,
+        CEILING(count(rw.reporting_work_id)/#{pageSize}) as 'pageTotal',
+        count(distinct rw.reporting_work_id) as 'total'
         FROM reporting_work AS rw
         LEFT JOIN reporting_work_detail AS rwd ON rw.reporting_work_id = rwd.reporting_work_id
         LEFT JOIN sd.order_glass_detail AS ogd ON ogd.order_id = rw.order_id
@@ -1060,7 +1062,7 @@
         <if test="reportingWork.teamsGroupsName != null and reportingWork.teamsGroupsName != ''">
             and rw.teams_groups_name regexp #{reportingWork.teamsGroupsName}
         </if>
-
+        limit #{offset},#{pageSize};
     </select>
 
     <select id="selectReviewedState">

--
Gitblit v1.8.0