|
@@ -180,25 +180,28 @@
|
180
|
180
|
|
181
|
181
|
<select id="getConsultantShareInfoList" resultType="com.huiju.estateagents.entity.TaConsultantInfo">
|
182
|
182
|
select * From (
|
183
|
|
- select
|
184
|
|
- t.target_id,
|
185
|
|
- a.url as activity_img,
|
186
|
|
- a.building_name as activity_name,
|
187
|
|
- a.building_name,
|
188
|
|
- a.address,
|
189
|
|
- a.price,
|
190
|
|
- t.event_type,
|
191
|
|
- t.visit_time
|
192
|
|
- from ta_person_visit_record t
|
193
|
|
- 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.target_id = a.building_id
|
194
|
|
- where t.event_type = 'building'
|
195
|
|
- and t.consultant_id = #{userId}
|
196
|
|
- and t.org_id = #{orgId}
|
197
|
|
- and t.`event` = 'share'
|
198
|
|
- group by t.target_id
|
|
183
|
+ select * from (
|
|
184
|
+ select
|
|
185
|
+ t.target_id,
|
|
186
|
+ a.url as activity_img,
|
|
187
|
+ a.building_name as activity_name,
|
|
188
|
+ a.building_name,
|
|
189
|
+ a.address,
|
|
190
|
+ a.price,
|
|
191
|
+ t.event_type,
|
|
192
|
+ t.visit_time
|
|
193
|
+ from ta_person_visit_record t
|
|
194
|
+ 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.target_id = a.building_id
|
|
195
|
+ where t.event_type = 'building'
|
|
196
|
+ and t.consultant_id = #{userId}
|
|
197
|
+ and t.org_id = #{orgId}
|
|
198
|
+ and t.`event` = 'share' order by t.visit_time desc
|
|
199
|
+ ) t
|
|
200
|
+ group by t.target_id
|
199
|
201
|
|
200
|
202
|
union all
|
201
|
203
|
|
|
204
|
+ select * from (
|
202
|
205
|
select
|
203
|
206
|
t.target_id,
|
204
|
207
|
b.list_img_url as activity_img,
|
|
@@ -213,11 +216,13 @@
|
213
|
216
|
where t.event_type = 'activity'
|
214
|
217
|
and t.consultant_id = #{userId}
|
215
|
218
|
and t.org_id = #{orgId}
|
216
|
|
- and t.`event` = 'share'
|
|
219
|
+ and t.`event` = 'share' order by t.visit_time desc
|
|
220
|
+ ) t
|
217
|
221
|
group by t.target_id
|
218
|
222
|
|
219
|
223
|
union all
|
220
|
224
|
|
|
225
|
+ select * from (
|
221
|
226
|
select
|
222
|
227
|
t.target_id,
|
223
|
228
|
c.list_img as activity_img,
|
|
@@ -232,11 +237,13 @@
|
232
|
237
|
where t.event_type = 'help'
|
233
|
238
|
and t.consultant_id = #{userId}
|
234
|
239
|
and t.org_id = #{orgId}
|
235
|
|
- and t.`event` = 'share'
|
|
240
|
+ and t.`event` = 'share' order by t.visit_time desc
|
|
241
|
+ ) t
|
236
|
242
|
group by t.target_id
|
237
|
243
|
|
238
|
244
|
union all
|
239
|
245
|
|
|
246
|
+ select * from (
|
240
|
247
|
select
|
241
|
248
|
t.target_id,
|
242
|
249
|
d.list_img as activity_img,
|
|
@@ -252,10 +259,12 @@
|
252
|
259
|
and t.consultant_id = #{userId}
|
253
|
260
|
and t.org_id = #{orgId}
|
254
|
261
|
and t.`event` = 'share'
|
255
|
|
- group by t.target_id
|
|
262
|
+ group by t.target_id order by t.visit_time desc
|
|
263
|
+ ) t
|
256
|
264
|
|
257
|
265
|
union all
|
258
|
266
|
|
|
267
|
+ select * from (
|
259
|
268
|
select
|
260
|
269
|
t.target_id,
|
261
|
270
|
e.news_img as activity_img,
|
|
@@ -270,27 +279,32 @@
|
270
|
279
|
where t.event_type = 'news'
|
271
|
280
|
and t.consultant_id = #{userId}
|
272
|
281
|
and t.org_id = #{orgId}
|
273
|
|
- and t.`event` = 'share'
|
|
282
|
+ and t.`event` = 'share' order by t.visit_time desc
|
|
283
|
+ ) t
|
274
|
284
|
group by t.target_id
|
275
|
285
|
|
276
|
286
|
union all
|
277
|
287
|
|
278
|
|
- select
|
279
|
|
- t.target_id,
|
280
|
|
- f.share_img as activity_img,
|
281
|
|
- f.`name` as activity_name,
|
282
|
|
- '1' as price,
|
283
|
|
- '2' as building_name,
|
284
|
|
- '3' as address,
|
285
|
|
- t.event_type,
|
286
|
|
- t.visit_time
|
287
|
|
- from ta_person_visit_record t
|
288
|
|
- left join ta_drainage f on t.target_id = f.drainage_id
|
289
|
|
- where t.event_type = 'h5'
|
290
|
|
- and t.consultant_id = #{userId}
|
291
|
|
- and t.org_id = #{orgId}
|
292
|
|
- and t.`event` = 'share'
|
293
|
|
- group by t.target_id ) t order by t.visit_time desc
|
|
288
|
+ select * from (
|
|
289
|
+ select
|
|
290
|
+ t.target_id,
|
|
291
|
+ f.share_img as activity_img,
|
|
292
|
+ f.`name` as activity_name,
|
|
293
|
+ '1' as price,
|
|
294
|
+ '2' as building_name,
|
|
295
|
+ '3' as address,
|
|
296
|
+ t.event_type,
|
|
297
|
+ t.visit_time
|
|
298
|
+ from ta_person_visit_record t
|
|
299
|
+ left join ta_drainage f on t.target_id = f.drainage_id
|
|
300
|
+ where t.event_type = 'h5'
|
|
301
|
+ and t.consultant_id = #{userId}
|
|
302
|
+ and t.org_id = #{orgId}
|
|
303
|
+ and t.`event` = 'share' order by t.visit_time desc
|
|
304
|
+ ) t
|
|
305
|
+ group by t.target_id
|
|
306
|
+ ) t
|
|
307
|
+ order by t.visit_time desc
|
294
|
308
|
</select>
|
295
|
309
|
|
296
|
310
|
<select id="countShareNumByEventType" resultType="java.lang.Integer">
|