|
@@ -6,10 +6,12 @@
|
|
|
<select id="selectCorpUserDetailByCondition" resultType="com.cyksj.model.views.CorpUserView">
|
|
<select id="selectCorpUserDetailByCondition" resultType="com.cyksj.model.views.CorpUserView">
|
|
|
select * from (select cu.id,
|
|
select * from (select cu.id,
|
|
|
cu.unionid,
|
|
cu.unionid,
|
|
|
- any_value(remark) as nickname,
|
|
|
|
|
group_concat(ct.tag_name) as tagNames,
|
|
group_concat(ct.tag_name) as tagNames,
|
|
|
group_concat(cf.name) as customers,
|
|
group_concat(cf.name) as customers,
|
|
|
- any_value(ct.created_time) as createdTime
|
|
|
|
|
|
|
+ any_value(ct.created_time) as createdTime,
|
|
|
|
|
+ u.id as userId,
|
|
|
|
|
+ u.nickname,
|
|
|
|
|
+ u.headimgurl
|
|
|
from (select * from corp_user_tag where
|
|
from (select * from corp_user_tag where
|
|
|
<choose>
|
|
<choose>
|
|
|
<when test="groupId!=null and groupId != ''">
|
|
<when test="groupId!=null and groupId != ''">
|
|
@@ -20,17 +22,17 @@
|
|
|
</otherwise>
|
|
</otherwise>
|
|
|
</choose>
|
|
</choose>
|
|
|
) ct
|
|
) ct
|
|
|
- inner join corp_user_follow_relation cfr on cfr.id = ct.relation_id and wx_corp_id = #{wxCorpId}
|
|
|
|
|
- left join corp_follow cf on cf.userid = cfr.follow_id
|
|
|
|
|
- left join corp_user_auth cua on cua.external_userid = cfr.corp_user_id
|
|
|
|
|
- left join corp_user cu on cu.id = cua.corp_user_id and cu.unionid != ''
|
|
|
|
|
- group by cu.id, cu.unionid) s order by s.createdTime desc
|
|
|
|
|
|
|
+ inner join corp_user_follow_relation cfr on cfr.id = ct.relation_id and cfr.wx_corp_id = #{wxCorpId}
|
|
|
|
|
+ inner join corp_follow cf on cf.userid = cfr.follow_id and cf.wx_corp_id = #{wxCorpId}
|
|
|
|
|
+ inner join corp_user_auth cua on cua.external_userid = cfr.corp_user_id and cua.wx_corp_id = #{wxCorpId}
|
|
|
|
|
+ inner join corp_user cu on cu.id = cua.corp_user_id and cu.unionid != ''
|
|
|
|
|
+ inner join user u on u.id = cu.user_id
|
|
|
|
|
+ group by cu.id, cu.unionid) s order by s.createdTime desc, s.userId asc
|
|
|
</select>
|
|
</select>
|
|
|
|
|
|
|
|
<select id="exportUserTagDetail" resultType="com.cyksj.model.excel.CorpUserTagExcelData">
|
|
<select id="exportUserTagDetail" resultType="com.cyksj.model.excel.CorpUserTagExcelData">
|
|
|
- select cu.id,
|
|
|
|
|
|
|
+ select * from (select cu.id,
|
|
|
cu.unionid,
|
|
cu.unionid,
|
|
|
- any_value(remark) as nickname,
|
|
|
|
|
group_concat(ct.tag_name) as tagNames,
|
|
group_concat(ct.tag_name) as tagNames,
|
|
|
group_concat(cf.name) as customers,
|
|
group_concat(cf.name) as customers,
|
|
|
any_value(ct.created_time) as tagTime,
|
|
any_value(ct.created_time) as tagTime,
|
|
@@ -54,11 +56,11 @@
|
|
|
</when>
|
|
</when>
|
|
|
</choose>
|
|
</choose>
|
|
|
) ct
|
|
) ct
|
|
|
- inner join corp_user_follow_relation cfr on cfr.id = ct.relation_id
|
|
|
|
|
- left join corp_follow cf on cf.userid = cfr.follow_id
|
|
|
|
|
- left join corp_user_auth cua on cua.external_userid = cfr.corp_user_id
|
|
|
|
|
- left join corp_user cu on cu.id = cua.corp_user_id and cu.unionid != ''
|
|
|
|
|
- left join user u on u.id = cu.user_id
|
|
|
|
|
- group by cu.id, cu.unionid
|
|
|
|
|
|
|
+ inner join corp_user_follow_relation cfr on cfr.id = ct.relation_id and cfr.wx_corp_id = #{wxCorpId}
|
|
|
|
|
+ inner join corp_follow cf on cf.userid = cfr.follow_id and cf.wx_corp_id = #{wxCorpId}
|
|
|
|
|
+ inner join corp_user_auth cua on cua.external_userid = cfr.corp_user_id and cua.wx_corp_id = #{wxCorpId}
|
|
|
|
|
+ inner join corp_user cu on cu.id = cua.corp_user_id and cu.unionid != ''
|
|
|
|
|
+ inner join user u on u.id = cu.user_id
|
|
|
|
|
+ group by cu.id, cu.unionid)s order by s.tagTime desc, s.userId asc
|
|
|
</select>
|
|
</select>
|
|
|
</mapper>
|
|
</mapper>
|