|
@@ -39,9 +39,8 @@
|
39
|
39
|
ta_channel c
|
40
|
40
|
LEFT JOIN ta_channel_person cp ON c.channel_id = cp.channel_id
|
41
|
41
|
LEFT JOIN ta_person tp ON cp.person_id = tp.person_id AND tp.person_type = 'estate agent' AND cp.STATUS = 1
|
42
|
|
- LEFT JOIN (SELECT sum(z.customerNum) as customerNum,z.qr_code_id,z.org_id,z.channel_id from (SELECT sum(new_customers) as customerNum,qr_code_id,channel_id,org_id from ts_activity_daily where channel_id is not null and org_id = #{orgId} GROUP BY channel_id
|
43
|
|
- union all
|
44
|
|
- SELECT sum(new_customers) as customerNum,qr_code_id,channel_id,org_id from ts_channel_daily where channel_id is not null and org_id = #{orgId} GROUP BY channel_id) z GROUP BY z.channel_id) ts on c.channel_id = ts.channel_id
|
|
42
|
+ LEFT JOIN (
|
|
43
|
+ SELECT sum(new_customers) as customerNum,qr_code_id,channel_id,org_id from ts_channel_daily where channel_id is not null and org_id = #{orgId} GROUP BY channel_id) ts on c.channel_id = ts.channel_id
|
45
|
44
|
<where>
|
46
|
45
|
<if test="channelId != null and channelId != ''">
|
47
|
46
|
c.channel_id = #{channelId}
|
|
@@ -73,18 +72,51 @@
|
73
|
72
|
SELECT
|
74
|
73
|
*
|
75
|
74
|
FROM
|
76
|
|
- ts_activity_daily
|
|
75
|
+ ts_channel_daily
|
77
|
76
|
WHERE
|
78
|
77
|
channel_id = #{channelId}
|
79
|
78
|
AND org_id = #{orgId}
|
80
|
|
- UNION ALL
|
|
79
|
+ <if test="startDate != null and endDate != null">
|
|
80
|
+ AND statis_date BETWEEN #{startDate} AND #{endDate}
|
|
81
|
+ </if>
|
|
82
|
+ <if test="channelType != null and channelType != ''">
|
|
83
|
+ and target_type = #{channelType}
|
|
84
|
+ </if>
|
|
85
|
+ <if test="buildingId != null and buildingId != ''">
|
|
86
|
+ and building_id = #{buildingId}
|
|
87
|
+ </if>
|
|
88
|
+ </select>
|
|
89
|
+ <select id="getActivityNewuserList"
|
|
90
|
+ resultType="com.huiju.estateagents.excel.ActivityStatistics.ChannelAddRegistNum">
|
81
|
91
|
SELECT
|
82
|
|
- *
|
83
|
|
- FROM
|
84
|
|
- ts_channel_daily
|
85
|
|
- WHERE
|
86
|
|
- channel_id = #{channelId}
|
87
|
|
- AND org_id = #{orgId}
|
|
92
|
+ a.nickname, a.phone,
|
|
93
|
+ if(a.gender = '1', '男', if(a.gender = '2', '女','未知') ) as gender,
|
|
94
|
+ a.province,
|
|
95
|
+ t.create_date
|
|
96
|
+ FROM ta_customer_from t
|
|
97
|
+ left join ta_person a on t.person_id = a.person_id
|
|
98
|
+<!-- left join ta_person_from_record b on a.person_id = b.person_id and b.org_id = #{orgId} and b.is_first_time =1-->
|
|
99
|
+<!-- left join td_wx_dict b1 on b.scene_id = b1.scene_id-->
|
|
100
|
+<!-- left join ta_recommend_customer c on c.person_id = t.person_id and c.realty_consultant is not null-->
|
|
101
|
+<!-- LEFT JOIN ta_user d ON c.realty_consultant = d.user_id-->
|
|
102
|
+<!-- LEFT JOIN ta_person e ON t.share_person_id = e.person_id-->
|
|
103
|
+ WHERE t.org_id = #{orgId}
|
|
104
|
+ and t.is_org_first = 1
|
|
105
|
+<!-- and t.create_date >= DATE_FORMAT(#{startDate}, '%Y-%m-%d' ) and t.create_date <= DATE_FORMAT(#{endDate},-->
|
|
106
|
+<!-- '%Y-%m-%d' )-->
|
|
107
|
+ <if test="activityId != null and activityId != ''">
|
|
108
|
+ and t.target_id = #{activityId}
|
|
109
|
+ </if>
|
|
110
|
+ <if test="activityType != null and activityType != ''">
|
|
111
|
+ and t.target_type = #{activityType}
|
|
112
|
+ </if>
|
|
113
|
+ <if test="buildingId != null and buildingId != ''">
|
|
114
|
+ and t.building_id = #{buildingId}
|
|
115
|
+ </if>
|
|
116
|
+ <if test="channelId != null and channelId != ''">
|
|
117
|
+ and t.channel_id = #{channelId}
|
|
118
|
+ </if>
|
|
119
|
+ group by t.person_id order by t.create_date desc
|
88
|
120
|
</select>
|
89
|
121
|
|
90
|
122
|
</mapper>
|