|
|
@@ -41,26 +41,21 @@
|
|
|
select * from (select cg.id as group_id,
|
|
|
cg.group_id as groupIdStr,
|
|
|
cg.group_name,
|
|
|
- count(distinct ct.id) as tagSize,
|
|
|
- count(cut.id) as numOfCustomer,
|
|
|
- any_value(cg.update_time) as updateTime
|
|
|
+ cg.update_time
|
|
|
from corp_tag_group cg
|
|
|
- left join corp_tag ct on ct.group_id = cg.group_id
|
|
|
- left join corp_user_tag cut on cut.tag_id = ct.tag_id
|
|
|
- left join corp_user_follow_relation cufr on cufr.id = cut.relation_id and cufr.wx_corp_id = #{wxCorpId}
|
|
|
- left join corp_user_auth cua on cua.external_userid = cufr.corp_user_id and cua.wx_corp_id = #{wxCorpId}
|
|
|
- left join corp_user cu on cu.id = cua.corp_user_id and cu.unionid != ''
|
|
|
- <where>
|
|
|
- <if test="groupIds != null and groupIds.length >0">
|
|
|
- cg.group_id in
|
|
|
- <foreach collection="groupIds" item="item" open="(" separator="," close=")">
|
|
|
- #{item}
|
|
|
- </foreach>
|
|
|
- </if>
|
|
|
- </where>
|
|
|
- group by cg.id,cg.group_id,cg.group_name order by cg.id desc)s
|
|
|
+ )s
|
|
|
<if test="sort != null">
|
|
|
order by ${sort} ${order}
|
|
|
</if>
|
|
|
</select>
|
|
|
+
|
|
|
+ <select id="fillCorpGroupTagInfo" resultType="com.cyksj.model.views.CorpTagBackView">
|
|
|
+ select count(distinct ct.id) as tagSize,
|
|
|
+ count(distinct corp_user_id) as numOfCustomer
|
|
|
+ from corp_tag ct
|
|
|
+ left join corp_user_tag cut on cut.tag_id = ct.tag_id
|
|
|
+ left join corp_user_follow_relation cufr on cufr.id = cut.relation_id
|
|
|
+ where ct.group_id = #{groupId}
|
|
|
+ and cufr.wx_corp_id = #{wxCorpId}
|
|
|
+ </select>
|
|
|
</mapper>
|