From f14c50cb0036d3ddd655ce4e34732ba396a836c4 Mon Sep 17 00:00:00 2001
From: java110 <928255095@qq.com>
Date: 星期二, 30 五月 2023 12:42:03 +0800
Subject: [PATCH] optimize 统计

---
 java110-db/src/main/resources/mapper/community/RepairUserServiceDaoImplMapper.xml |   11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/java110-db/src/main/resources/mapper/community/RepairUserServiceDaoImplMapper.xml b/java110-db/src/main/resources/mapper/community/RepairUserServiceDaoImplMapper.xml
index 08b896c..1285234 100755
--- a/java110-db/src/main/resources/mapper/community/RepairUserServiceDaoImplMapper.xml
+++ b/java110-db/src/main/resources/mapper/community/RepairUserServiceDaoImplMapper.xml
@@ -102,10 +102,13 @@
         t.b_id bId,t.staff_id,t.staff_id staffId,t.staff_name,t.staff_name staffName,
         t.pre_staff_id,t.pre_staff_id preStaffId,t.pre_staff_name,t.pre_staff_name preStaffName,
         t.start_time,t.start_time startTime,t.end_time,t.end_time endTime,d.name stateName,
-        t.repair_event,t.repair_event repairEvent, t.pre_ru_id,t.pre_ru_id preRuId,t.create_time createTime
+        t.repair_event,t.repair_event repairEvent, t.pre_ru_id,t.pre_ru_id preRuId,t.create_time createTime,
+        rp.pay_type payType,d2.name payTypeName
         from r_repair_user t
+        left join r_repair_pool rp on t.repair_id = rp.repair_id and t.state in ('10009','12000')
         left join t_dict d on t.state = d.status_cd and d.table_name = 'r_repair_user' and d.table_columns = 'state'
-        where 1 =1
+        left join t_dict d2 on rp.pay_type = d2.status_cd and d2.table_name = 'r_repair_pool' and d2.table_columns = 'pay_type'
+        where 1 = 1
         <if test="context !=null and context != ''">
             and t.context= #{context}
         </if>
@@ -204,8 +207,10 @@
     <select id="queryRepairUsersCount" parameterType="Map" resultType="Map">
         select count(1) count
         from r_repair_user t
+        left join r_repair_pool rp on t.repair_id = rp.repair_id and t.state in ('10009','12000')
         left join t_dict d on t.state = d.status_cd and d.table_name = 'r_repair_user' and d.table_columns = 'state'
-        where 1 =1
+        left join t_dict d2 on rp.pay_type = d2.status_cd and d2.table_name = 'r_repair_pool' and d2.table_columns = 'pay_type'
+        where 1 = 1
         <if test="context !=null and context != ''">
             and t.context= #{context}
         </if>

--
Gitblit v1.8.0