From 7987c4f005f5bd8739411d08e4e3bfb67e4df9ef Mon Sep 17 00:00:00 2001
From: wuxw <928255095@qq.com>
Date: 星期日, 01 十二月 2019 13:48:07 +0800
Subject: [PATCH] 优化设备脚本查询
---
java110-db/src/main/resources/mapper/community/CommunityServiceDaoImplMapper.xml | 40 +++++++++++++++++++++++++++++++++++-----
1 files changed, 35 insertions(+), 5 deletions(-)
diff --git a/java110-db/src/main/resources/mapper/community/CommunityServiceDaoImplMapper.xml b/java110-db/src/main/resources/mapper/community/CommunityServiceDaoImplMapper.xml
index 0080e9a..76b7490 100644
--- a/java110-db/src/main/resources/mapper/community/CommunityServiceDaoImplMapper.xml
+++ b/java110-db/src/main/resources/mapper/community/CommunityServiceDaoImplMapper.xml
@@ -277,7 +277,7 @@
<!-- 鏌ヨ灏忓尯鎴愬憳 add by wuxw 2018-07-03 -->
<select id="getCommunityMember" parameterType="Map" resultType="Map">
- select ms.community_member_id ,ms.b_id,ms.community_id,ms.member_id,ms.member_type_cd,ms.status_cd,ms.audit_status_cd,
+ select ms.community_member_id , ms.b_id,ms.community_id,ms.member_id,ms.member_type_cd,ms.status_cd,ms.audit_status_cd,
ms.community_member_id communityMemberId ,ms.b_id bId,ms.community_id communityId,ms.member_id memberId,ms.member_type_cd memberTypeCd,ms.status_cd statusCd,
ms.audit_status_cd auditStatusCd,
(CASE
@@ -293,7 +293,8 @@
</if>
from s_community_member ms
<if test="needCommunityInfo == true">
- ,s_community sc
+ ,s_community sc,
+ s_community_member msc
</if>
where 1=1
<if test="needCommunityInfo == true">
@@ -311,8 +312,15 @@
<if test="communityMemberId != null and communityMemberId !=''">
and ms.community_member_id = #{communityMemberId}
</if>
- <if test="memberId != null and memberId != ''">
+ <if test="memberId != null and memberId != '' and needCommunityInfo == true">
+ AND ms.`community_id` = msc.`community_id`
+ and msc.member_id = #{memberId}
+ </if>
+ <if test="memberId != null and memberId != '' and needCommunityInfo == false">
and ms.member_id = #{memberId}
+ </if>
+ <if test="noAuditEnterCommunity == true">
+ and ms.member_type_cd not in ('390001200003','390001200005','390001200000')
</if>
<if test="memberTypeCd != null and memberTypeCd != ''">
and ms.member_type_cd = #{memberTypeCd}
@@ -353,7 +361,8 @@
select count(1) count
from s_community_member ms
<if test="needCommunityInfo == true">
- ,s_community sc
+ ,s_community sc,
+ s_community_member msc
</if>
where 1=1
<if test="needCommunityInfo == true">
@@ -371,9 +380,18 @@
<if test="communityMemberId != null and communityMemberId !=''">
and ms.community_member_id = #{communityMemberId}
</if>
- <if test="memberId != null and memberId != ''">
+ <if test="memberId != null and memberId != '' and needCommunityInfo == true">
+ AND ms.`community_id` = msc.`community_id`
+ and msc.member_id = #{memberId}
+ </if>
+ <if test="memberId != null and memberId != '' and needCommunityInfo == false">
and ms.member_id = #{memberId}
</if>
+
+ <if test="noAuditEnterCommunity == true">
+ and ms.member_type_cd not in ('390001200003','390001200005','390001200000')
+ </if>
+
<if test="memberTypeCd != null and memberTypeCd != ''">
and ms.member_type_cd = #{memberTypeCd}
</if>
@@ -381,6 +399,12 @@
and ms.audit_status_cd = #{auditStatusCd}
</if>
+ <if test="auditStatusCds != null and auditStatusCds != null">
+ and ms.audit_status_cd in
+ <foreach collection="auditStatusCds" item="item" open="(" close=")" separator=",">
+ #{item}
+ </foreach>
+ </if>
<if test="communityId != null and communityId != ''">
and ms.community_id = #{communityId}
</if>
@@ -422,6 +446,12 @@
<if test="communityId !=null and communityId != ''">
and t.community_id= #{communityId}
</if>
+ <if test="communityIds !=null">
+ and t.community_id in
+ <foreach collection="communityIds" item="item" open="(" close=")" separator=",">
+ #{item}
+ </foreach>
+ </if>
<if test="bId !=null and bId != ''">
and t.b_id= #{bId}
</if>
--
Gitblit v1.8.0