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/store/ScheduleClassesStaffV1ServiceDaoImplMapper.xml | 25 +++++++++++++++++++++++--
1 files changed, 23 insertions(+), 2 deletions(-)
diff --git a/java110-db/src/main/resources/mapper/store/ScheduleClassesStaffV1ServiceDaoImplMapper.xml b/java110-db/src/main/resources/mapper/store/ScheduleClassesStaffV1ServiceDaoImplMapper.xml
index d45ed42..3ee4493 100644
--- a/java110-db/src/main/resources/mapper/store/ScheduleClassesStaffV1ServiceDaoImplMapper.xml
+++ b/java110-db/src/main/resources/mapper/store/ScheduleClassesStaffV1ServiceDaoImplMapper.xml
@@ -18,11 +18,22 @@
<!-- 鏌ヨ鎺掔彮鍛樺伐淇℃伅 add by wuxw 2018-07-03 -->
<select id="getScheduleClassesStaffInfo" parameterType="Map" resultType="Map">
select t.staff_name,t.staff_name staffName,t.status_cd,t.status_cd statusCd,t.store_id,t.store_id
- storeId,t.scs_id,t.scs_id scsId,t.schedule_id,t.schedule_id scheduleId,t.staff_id,t.staff_id staffId
+ storeId,t.scs_id,t.scs_id scsId,t.schedule_id,t.schedule_id scheduleId,t.staff_id,t.staff_id staffId,
+ t.create_time createTime
from schedule_classes_staff t
+ INNER JOIN schedule_classes sc on t.schedule_id = sc.schedule_id and sc.state = '1001'
+ <if test="orgId !=null and orgId != ''">
+ left join u_org_staff_rel osr on t.staff_id = osr.staff_id and osr.status_cd = '0'
+ </if>
where 1 =1
+ <if test="orgId !=null and orgId != ''">
+ and osr.org_id = #{orgId}
+ </if>
<if test="staffName !=null and staffName != ''">
and t.staff_name= #{staffName}
+ </if>
+ <if test="staffNameLike !=null and staffNameLike != ''">
+ and t.staff_name like concat('%', #{staffNameLike},'%')
</if>
<if test="statusCd !=null and statusCd != ''">
and t.status_cd= #{statusCd}
@@ -76,9 +87,19 @@
<select id="queryScheduleClassesStaffsCount" parameterType="Map" resultType="Map">
select count(1) count
from schedule_classes_staff t
+ INNER JOIN schedule_classes sc on t.schedule_id = sc.schedule_id and sc.state = '1001'
+ <if test="orgId !=null and orgId != ''">
+ left join u_org_staff_rel osr on t.staff_id = osr.staff_id and osr.status_cd = '0'
+ </if>
where 1 =1
+ <if test="orgId !=null and orgId != ''">
+ and osr.org_id = #{orgId}
+ </if>
<if test="staffName !=null and staffName != ''">
and t.staff_name= #{staffName}
+ </if>
+ <if test="staffNameLike !=null and staffNameLike != ''">
+ and t.staff_name like concat('%', #{staffNameLike},'%')
</if>
<if test="statusCd !=null and statusCd != ''">
and t.status_cd= #{statusCd}
@@ -104,7 +125,7 @@
select t.schedule_id scheduleId,count(1) staffCount
from schedule_classes_staff t
where 1 =1
- and t.status_cd= '0'
+ and t.status_cd= '0'
<if test="storeId !=null and storeId != ''">
and t.store_id= #{storeId}
</if>
--
Gitblit v1.8.0