|
@@ -123,7 +123,7 @@
|
123
|
123
|
|
124
|
124
|
<select id="getWxActivityVisitRecordList" resultType="com.huiju.estateagents.entity.TaPersonVisitRecord">
|
125
|
125
|
SELECT
|
126
|
|
- t.* ,
|
|
126
|
+ t.share_from_id, t.share_person as consultant_id, t.share_person_type, t.person_id, t.target_type, t.target_id, t.create_date as visit_time, t.org_id ,building_id, t.status, t.is_first_time,
|
127
|
127
|
p.`name` as user_name,
|
128
|
128
|
p.`nickname` as nickname,
|
129
|
129
|
p.avatarurl
|
|
@@ -154,7 +154,12 @@
|
154
|
154
|
<select id="getDrainageVisitRecord" resultType="com.huiju.estateagents.entity.TaPersonVisitRecord">
|
155
|
155
|
select * from (
|
156
|
156
|
select
|
157
|
|
- <include refid="columnSql"></include>,
|
|
157
|
+<!-- <include refid="columnSql"></include>,-->
|
|
158
|
+ t.person_id,
|
|
159
|
+ c.person_type,
|
|
160
|
+ t.create_date as visit_time,
|
|
161
|
+ t.tagert_type as event_type,
|
|
162
|
+ t.be_share as target_id,
|
158
|
163
|
b.name as drainageName,
|
159
|
164
|
d.building_name as buildingName,
|
160
|
165
|
tn.news_name as newsName,
|
|
@@ -162,26 +167,25 @@
|
162
|
167
|
tsa.activity_name as groupActivityName,
|
163
|
168
|
tbd.title as activityName,
|
164
|
169
|
b.drainage_id
|
165
|
|
- from ta_person_visit_record t
|
166
|
|
- left join ta_drainage b on t.target_id = b.drainage_id
|
167
|
|
- left join ta_building d on t.target_id = d.building_id
|
168
|
|
- left join ta_news tn on t.target_id = tn.news_id
|
169
|
|
- left join ta_help_activity tha on t.target_id = tha.help_activity_id
|
170
|
|
- left join ta_share_activity tsa on t.target_id = tsa.group_activity_id
|
171
|
|
- left join ta_building_dynamic tbd on t.target_id = tbd.dynamic_id
|
172
|
|
- left join ta_person c on t.share_person_id = c.person_id
|
173
|
|
- where
|
174
|
|
- t.share_person_id != t.person_id and t.share_person_id is not null and t.share_person_id != ''
|
|
170
|
+ from ta_share t
|
|
171
|
+ left join ta_drainage b on t.be_share = b.drainage_id
|
|
172
|
+ left join ta_building d on t.be_share = d.building_id
|
|
173
|
+ left join ta_news tn on t.be_share = tn.news_id
|
|
174
|
+ left join ta_help_activity tha on t.be_share = tha.help_activity_id
|
|
175
|
+ left join ta_share_activity tsa on t.be_share = tsa.group_activity_id
|
|
176
|
+ left join ta_building_dynamic tbd on t.be_share = tbd.dynamic_id
|
|
177
|
+ left join ta_person c on t.person_id = c.person_id
|
|
178
|
+ where 1=1
|
175
|
179
|
<if test="orgId != null and orgId != ''">
|
176
|
|
- and t.org_id = #{orgId}
|
|
180
|
+ and c.org_id = #{orgId}
|
177
|
181
|
</if>
|
178
|
182
|
<if test="eventType !=null and eventType != ''">
|
179
|
|
- and t.event_type = #{eventType}
|
|
183
|
+ and t.tagert_type = #{eventType}
|
180
|
184
|
</if>
|
181
|
185
|
<if test="activityName !=null and activityName != ''">
|
182
|
186
|
and (
|
183
|
|
- (b.name like concat('%',#{activityName},'%') and t.event_type = 'h5')or (d.name like concat('%',#{activityName},'%') and t.event_type = 'building') or (tn.news_name like concat('%',#{activityName},'%') and t.event_type = 'news')
|
184
|
|
- or (tha.title like concat( '%', #{activityName}, '%' ) and t.event_type = 'help') or (tsa.activity_name like concat('%',#{activityName},'%') and t.event_type = 'group') or (tbd.title like concat('%',#{activityName},'%') and t.event_type = 'activity')
|
|
187
|
+ (b.name like concat('%',#{activityName},'%') and t.tagert_type = 'h5')or (d.name like concat('%',#{activityName},'%') and t.tagert_type = 'building') or (tn.news_name like concat('%',#{activityName},'%') and t.tagert_type = 'news')
|
|
188
|
+ or (tha.title like concat( '%', #{activityName}, '%' ) and t.tagert_type = 'help') or (tsa.activity_name like concat('%',#{activityName},'%') and t.tagert_type = 'group') or (tbd.title like concat('%',#{activityName},'%') and t.tagert_type = 'activity')
|
185
|
189
|
)
|
186
|
190
|
</if>
|
187
|
191
|
<if test="shareName !=null and shareName != ''">
|
|
@@ -191,23 +195,23 @@
|
191
|
195
|
and c.phone = #{shareTel}
|
192
|
196
|
</if>
|
193
|
197
|
<if test="personType == 'Realty Consultant'">
|
194
|
|
- and t.consultant_id is not null and t.consultant_id != ''
|
|
198
|
+ and c.person_type = 'Realty Consultant'
|
195
|
199
|
</if>
|
196
|
200
|
<if test="personType == 'customer'">
|
197
|
|
- and t.consultant_id is null
|
|
201
|
+ and c.person_type != 'Realty Consultant'
|
198
|
202
|
</if>
|
199
|
203
|
<if test="buildingId !=null and buildingId != ''">
|
200
|
|
- and t.building_id = #{buildingId}
|
|
204
|
+ and d.building_id = #{buildingId}
|
201
|
205
|
</if>
|
202
|
206
|
<if test="personBuildingList != null and personBuildingList.size > 0">
|
203
|
|
- AND t.building_id in
|
|
207
|
+ AND d.building_id in
|
204
|
208
|
<foreach collection="personBuildingList" item="personBuilding" open="(" close=")" separator=",">
|
205
|
209
|
#{personBuilding.buildingId}
|
206
|
210
|
</foreach>
|
207
|
211
|
</if>
|
208
|
|
- order by t.visit_time desc
|
|
212
|
+ order by t.create_date desc
|
209
|
213
|
) t
|
210
|
|
- group by t.person_id, t.share_person_id,t.target_id,t.event_type
|
|
214
|
+ group by t.person_id, t.target_id,t.event_type
|
211
|
215
|
order by t.visit_time desc
|
212
|
216
|
</select>
|
213
|
217
|
|
|
@@ -222,7 +226,7 @@
|
222
|
226
|
a.address,
|
223
|
227
|
a.price,
|
224
|
228
|
t.tagert_type as eventType,
|
225
|
|
- t.create_date
|
|
229
|
+ t.create_date as visit_time
|
226
|
230
|
from ta_share t
|
227
|
231
|
left join (select b.url, a.building_name,a.address,a.price,a.building_id from ta_building a left join ta_building_img b on a.building_id = b.building_id where b.img_type = 'list') a on t.be_share = a.building_id
|
228
|
232
|
where t.tagert_type = 'project'
|
|
@@ -241,7 +245,7 @@
|
241
|
245
|
'2' as building_name,
|
242
|
246
|
'3' as address,
|
243
|
247
|
t.tagert_type as eventType,
|
244
|
|
- t.create_date
|
|
248
|
+ t.create_date as visit_time
|
245
|
249
|
from ta_share t
|
246
|
250
|
left join ta_building_dynamic b on t.be_share = b.dynamic_id
|
247
|
251
|
where t.tagert_type = 'activity'
|
|
@@ -260,7 +264,7 @@
|
260
|
264
|
'2' as building_name,
|
261
|
265
|
'3' as address,
|
262
|
266
|
t.tagert_type as eventType,
|
263
|
|
- t.create_date
|
|
267
|
+ t.create_date as visit_time
|
264
|
268
|
from ta_share t
|
265
|
269
|
left join ta_help_activity c on t.be_share = c.help_activity_id
|
266
|
270
|
where t.tagert_type = 'help'
|
|
@@ -279,7 +283,7 @@
|
279
|
283
|
'2' as building_name,
|
280
|
284
|
'3' as address,
|
281
|
285
|
t.tagert_type as eventType,
|
282
|
|
- t.create_date
|
|
286
|
+ t.create_date as visit_time
|
283
|
287
|
from ta_share t
|
284
|
288
|
left join ta_share_activity d on t.be_share = d.group_activity_id
|
285
|
289
|
where t.tagert_type = 'group'
|
|
@@ -298,7 +302,7 @@
|
298
|
302
|
'2' as building_name,
|
299
|
303
|
'3' as address,
|
300
|
304
|
t.tagert_type as eventType,
|
301
|
|
- t.create_date
|
|
305
|
+ t.create_date as visit_time
|
302
|
306
|
from ta_share t
|
303
|
307
|
left join ta_news e on t.be_share = e.news_id
|
304
|
308
|
where t.tagert_type = 'news'
|
|
@@ -317,7 +321,7 @@
|
317
|
321
|
'2' as building_name,
|
318
|
322
|
'3' as address,
|
319
|
323
|
t.tagert_type as eventType,
|
320
|
|
- t.create_date
|
|
324
|
+ t.create_date as visit_time
|
321
|
325
|
from ta_share t
|
322
|
326
|
left join ta_drainage f on t.be_share = f.drainage_id
|
323
|
327
|
where t.tagert_type = 'h5'
|
|
@@ -325,7 +329,7 @@
|
325
|
329
|
) t
|
326
|
330
|
group by t.target_id
|
327
|
331
|
) t
|
328
|
|
- order by t.create_date desc
|
|
332
|
+ order by t.visit_time desc
|
329
|
333
|
</select>
|
330
|
334
|
|
331
|
335
|
<select id="countShareNumByEventType" resultType="java.lang.Integer">
|