Commit 92e88e37 by 徐高华

sql优化

parent 3b9cdcb8
...@@ -369,11 +369,14 @@ ...@@ -369,11 +369,14 @@
</select> </select>
<select id="listMemberStaffRelNew" resultType="com.gic.haoban.manage.service.entity.ext.MemberStaffRelExtDO"> <select id="listMemberStaffRelNew" resultType="com.gic.haoban.manage.service.entity.ext.MemberStaffRelExtDO">
select * from (
select ecr.member_id as memberId, select ecr.member_id as memberId,
ecr.external_user_id as memberExternalUserId, ecr.external_user_id as memberExternalUserId,
scr.staff_id as staffId, scr.staff_id as staffId,
scr.clerk_id as staffClerkId scr.clerk_id as staffClerkId
from (select a.staff_id, from tab_haoban_external_clerk_related as ecr
left join
(select a.staff_id,
a.clerk_id a.clerk_id
from tab_haoban_staff_clerk_relation a from tab_haoban_staff_clerk_relation a
left join tab_haoban_staff b on a.staff_id = b.staff_id left join tab_haoban_staff b on a.staff_id = b.staff_id
...@@ -382,14 +385,14 @@ ...@@ -382,14 +385,14 @@
#{item} #{item}
</foreach> </foreach>
and a.status_flag = 1 and a.status_flag = 1
group by a.staff_id, b.wx_user_id, a.clerk_id) as scr group by a.staff_id, a.clerk_id) as scr on scr.staff_id = ecr.staff_id
left join tab_haoban_external_clerk_related as ecr on scr.staff_id = ecr.staff_id
where ecr.status_flag = 1 where ecr.status_flag = 1
and ecr.enterprise_id = #{enterpriseId,jdbcType=VARCHAR} and ecr.enterprise_id = #{enterpriseId,jdbcType=VARCHAR}
and ecr.member_id in and ecr.member_id in
<foreach collection="memberIdList" item="item" separator="," open="(" close=")"> <foreach collection="memberIdList" item="item" separator="," open="(" close=")">
#{item} #{item}
</foreach> </foreach>
) t where t.staffId is not null
</select> </select>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment