From d2a3c95c4fbb71a4b73638bc4bd968a66c96df87 Mon Sep 17 00:00:00 2001
From: xiangpei <xiangpei@timesnew.cn>
Date: 星期二, 03 九月 2024 11:13:44 +0800
Subject: [PATCH] 工单下发分页统计bug

---
 ycl-server/src/main/resources/mapper/zgyw/YwUnitMapper.xml                 |    6 +++---
 ycl-server/src/main/resources/mapper/zgyw/WorkOrderMapper.xml              |    3 +++
 ycl-server/src/main/java/com/ycl/platform/controller/YwUnitController.java |    2 +-
 3 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/ycl-server/src/main/java/com/ycl/platform/controller/YwUnitController.java b/ycl-server/src/main/java/com/ycl/platform/controller/YwUnitController.java
index 580ecc0..3d097f0 100644
--- a/ycl-server/src/main/java/com/ycl/platform/controller/YwUnitController.java
+++ b/ycl-server/src/main/java/com/ycl/platform/controller/YwUnitController.java
@@ -83,7 +83,7 @@
     }
 
     @GetMapping("/work/list")
-    @ApiOperation(value = "宸ュ崟鍒楄〃", notes = "宸ュ崟鍒楄〃")
+    @ApiOperation(value = "缁熻杩愮淮鍗曚綅宸ュ崟鏁伴噺", notes = "缁熻杩愮淮鍗曚綅宸ュ崟鏁伴噺")
     public Result workList(DistributeWorkOrderQuery query) {
         return ywUnitService.workList(query);
     }
diff --git a/ycl-server/src/main/resources/mapper/zgyw/WorkOrderMapper.xml b/ycl-server/src/main/resources/mapper/zgyw/WorkOrderMapper.xml
index 7dd7578..caddc95 100644
--- a/ycl-server/src/main/resources/mapper/zgyw/WorkOrderMapper.xml
+++ b/ycl-server/src/main/resources/mapper/zgyw/WorkOrderMapper.xml
@@ -96,6 +96,9 @@
             <if test="query.unitId != null">
                 AND wo.unit_id = #{query.unitId}
             </if>
+            <if test="query.unitId == null">
+                AND wo.unit_id is not null
+            </if>
             <if test="query.status != null and query.status != ''">
                 AND wo.status = #{query.status}
             </if>
diff --git a/ycl-server/src/main/resources/mapper/zgyw/YwUnitMapper.xml b/ycl-server/src/main/resources/mapper/zgyw/YwUnitMapper.xml
index 5f3f169..159fc09 100644
--- a/ycl-server/src/main/resources/mapper/zgyw/YwUnitMapper.xml
+++ b/ycl-server/src/main/resources/mapper/zgyw/YwUnitMapper.xml
@@ -35,10 +35,10 @@
 
     <select id="workList" resultType="integer">
         SELECT
-               count(*)
+               count(DISTINCT wo.id)
         FROM
             t_work_order wo
-            INNER JOIN t_monitor tm ON wo.serial_number = tm.serial_number AND #{query.unitId}
+            INNER JOIN t_monitor tm ON wo.serial_number = tm.serial_number
             INNER JOIN t_yw_point yp ON yp.serial_number = wo.serial_number AND yp.deleted = 0
             INNER JOIN t_work_order_error_type et ON wo.work_order_no = et.work_order_no
             INNER JOIN sys_dict_data da ON da.dict_value = et.error_name AND da.dict_type = 'error_type'
@@ -46,7 +46,7 @@
                     collection="query.errorTypeList" open="(" separator="," close=")" item="errorType">#{errorType}</foreach>
             </if>
         WHERE
-            wo.deleted = 0
+            wo.unit_id = #{query.unitId} AND wo.deleted = 0
             <if test="query.status != null and query.status != ''">
                 AND wo.status = #{query.status}
             </if>

--
Gitblit v1.8.0