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

---
 java110-db/src/main/resources/mapper/common/AccessControlWhiteV1ServiceDaoImplMapper.xml |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/java110-db/src/main/resources/mapper/common/AccessControlWhiteV1ServiceDaoImplMapper.xml b/java110-db/src/main/resources/mapper/common/AccessControlWhiteV1ServiceDaoImplMapper.xml
index e5e466f..4eac5cf 100644
--- a/java110-db/src/main/resources/mapper/common/AccessControlWhiteV1ServiceDaoImplMapper.xml
+++ b/java110-db/src/main/resources/mapper/common/AccessControlWhiteV1ServiceDaoImplMapper.xml
@@ -19,13 +19,12 @@
     <select id="getAccessControlWhiteInfo" parameterType="Map" resultType="Map">
         select t.third_id,t.third_id thirdId,t.id_card,t.id_card idCard,t.access_control_key,t.access_control_key
         accessControlKey,t.status_cd,t.status_cd statusCd,t.person_name,t.person_name
-        personName,t.machine_id,t.machine_id machineId,t.acw_id,t.acw_id acwId,t.person_id,t.person_id
+        personName,t.acw_id,t.acw_id acwId,t.person_id,t.person_id
         personId,t.tel,t.start_time,t.start_time startTime,t.end_time,t.end_time endTime,t.community_id,t.community_id
-        communityId,t.person_type,t.person_type personType,t.create_time createTime,m.machine_code machineCode,m.machine_name machineName,
-        td.`name` personTypeName
+        communityId,t.person_type,t.person_type personType,td.`name` personTypeName,t.create_time createTime,count(acwa.acwa_id) machineCount
         from access_control_white t
-        left join machine m on t.machine_id = m.machine_id and m.status_cd = '0'
         left join t_dict td on t.person_type = td.status_cd and td.table_name ='access_control_white' and td.table_columns = 'person_type'
+        left join access_control_white_auth acwa on t.acw_id = acwa.acw_id and acwa.community_id = t.community_id and acwa.status_cd = '0'
         where 1 =1
         <if test="thirdId !=null and thirdId != ''">
             and t.third_id= #{thirdId}
@@ -69,6 +68,8 @@
         <if test="personType !=null and personType != ''">
             and t.person_type= #{personType}
         </if>
+        group by t.third_id,t.id_card,t.access_control_key,t.status_cd,t.person_name,t.acw_id,t.person_id,t.tel,t.start_time,
+        t.end_time,t.community_id,t.person_type,td.`name`,t.create_time
         order by t.create_time desc
         <if test="page != -1 and page != null ">
             limit #{page}, #{row}

--
Gitblit v1.8.0