|
@@ -141,7 +141,8 @@
|
141
|
141
|
left join ta_building_dynamic tbd on t.target_id = tbd.dynamic_id
|
142
|
142
|
left join ta_person c on t.share_person_id = c.person_id
|
143
|
143
|
where
|
144
|
|
- t.share_person_id is not null
|
|
144
|
+ 1=1
|
|
145
|
+-- t.share_person_id is not null
|
145
|
146
|
<if test="orgId != null and orgId != ''">
|
146
|
147
|
and t.org_id = #{orgId}
|
147
|
148
|
</if>
|
|
@@ -149,7 +150,10 @@
|
149
|
150
|
and t.event_type = #{eventType}
|
150
|
151
|
</if>
|
151
|
152
|
<if test="activityName !=null and activityName != ''">
|
152
|
|
- and b.name like concat('%',#{activityName},'%')
|
|
153
|
+ and (
|
|
154
|
+ b.name like concat('%',#{activityName},'%') or d.name like concat('%',#{activityName},'%') or tn.news_name like concat('%',#{activityName},'%')
|
|
155
|
+ or tha.title like concat( '%', #{activityName}, '%' ) or tsa.activity_name like concat('%',#{activityName},'%') or tbd.title like concat('%',#{activityName},'%')
|
|
156
|
+ )
|
153
|
157
|
</if>
|
154
|
158
|
<if test="shareName !=null and shareName != ''">
|
155
|
159
|
and c.nickname like concat('%',#{shareName},'%')
|
|
@@ -164,7 +168,7 @@
|
164
|
168
|
and t.consultant_id is null
|
165
|
169
|
</if>
|
166
|
170
|
<if test="buildingId !=null and buildingId != ''">
|
167
|
|
- and d.building_id = #{buildingId}
|
|
171
|
+ and t.building_id = #{buildingId}
|
168
|
172
|
</if>
|
169
|
173
|
<if test="personBuildingList != null and personBuildingList.size > 0">
|
170
|
174
|
AND t.building_id in
|
|
@@ -179,20 +183,22 @@
|
179
|
183
|
</select>
|
180
|
184
|
|
181
|
185
|
<select id="getConsultantShareInfoList" resultType="com.huiju.estateagents.entity.TaConsultantInfo">
|
|
186
|
+ select * From (
|
182
|
187
|
select
|
183
|
188
|
a.url as activity_img,
|
184
|
189
|
a.building_name as activity_name,
|
185
|
190
|
a.building_name,
|
186
|
191
|
a.address,
|
187
|
192
|
a.price,
|
188
|
|
- t.event_type
|
|
193
|
+ t.event_type,
|
|
194
|
+ t.visit_time
|
189
|
195
|
from ta_person_visit_record t
|
190
|
196
|
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
|
191
|
197
|
where t.event_type = 'building'
|
192
|
198
|
and t.consultant_id = #{userId}
|
193
|
199
|
and t.org_id = #{orgId}
|
194
|
200
|
and t.`event` = 'share'
|
195
|
|
- order by t.visit_time desc
|
|
201
|
+ group by t.target_id
|
196
|
202
|
|
197
|
203
|
union all
|
198
|
204
|
|
|
@@ -202,14 +208,15 @@
|
202
|
208
|
'1' as price,
|
203
|
209
|
'2' as building_name,
|
204
|
210
|
'3' as address,
|
205
|
|
- t.event_type
|
|
211
|
+ t.event_type,
|
|
212
|
+ t.visit_time
|
206
|
213
|
from ta_person_visit_record t
|
207
|
214
|
left join ta_building_dynamic b on t.target_id = b.dynamic_id
|
208
|
215
|
where t.event_type = 'activity'
|
209
|
216
|
and t.consultant_id = #{userId}
|
210
|
217
|
and t.org_id = #{orgId}
|
211
|
218
|
and t.`event` = 'share'
|
212
|
|
- order by t.visit_time desc
|
|
219
|
+ group by t.target_id
|
213
|
220
|
|
214
|
221
|
union all
|
215
|
222
|
|
|
@@ -219,14 +226,15 @@
|
219
|
226
|
'1' as price,
|
220
|
227
|
'2' as building_name,
|
221
|
228
|
'3' as address,
|
222
|
|
- t.event_type
|
|
229
|
+ t.event_type,
|
|
230
|
+ t.visit_time
|
223
|
231
|
from ta_person_visit_record t
|
224
|
232
|
left join ta_help_activity c on t.target_id = c.help_activity_id
|
225
|
233
|
where t.event_type = 'help'
|
226
|
234
|
and t.consultant_id = #{userId}
|
227
|
235
|
and t.org_id = #{orgId}
|
228
|
236
|
and t.`event` = 'share'
|
229
|
|
- order by t.visit_time desc
|
|
237
|
+ group by t.target_id
|
230
|
238
|
|
231
|
239
|
union all
|
232
|
240
|
|
|
@@ -236,48 +244,51 @@
|
236
|
244
|
'1' as price,
|
237
|
245
|
'2' as building_name,
|
238
|
246
|
'3' as address,
|
239
|
|
- t.event_type
|
|
247
|
+ t.event_type,
|
|
248
|
+ t.visit_time
|
240
|
249
|
from ta_person_visit_record t
|
241
|
250
|
left join ta_share_activity d on t.target_id = d.group_activity_id
|
242
|
251
|
where t.event_type = 'group'
|
243
|
252
|
and t.consultant_id = #{userId}
|
244
|
253
|
and t.org_id = #{orgId}
|
245
|
254
|
and t.`event` = 'share'
|
246
|
|
- order by t.visit_time desc
|
|
255
|
+ group by t.target_id
|
247
|
256
|
|
248
|
257
|
union all
|
249
|
258
|
|
250
|
259
|
select
|
251
|
260
|
e.news_img as activity_img,
|
252
|
|
- e.news_name,
|
|
261
|
+ e.news_name as activity_name,
|
253
|
262
|
'1' as price,
|
254
|
263
|
'2' as building_name,
|
255
|
264
|
'3' as address,
|
256
|
|
- t.event_type
|
|
265
|
+ t.event_type,
|
|
266
|
+ t.visit_time
|
257
|
267
|
from ta_person_visit_record t
|
258
|
268
|
left join ta_news e on t.target_id = e.news_id
|
259
|
269
|
where t.event_type = 'news'
|
260
|
270
|
and t.consultant_id = #{userId}
|
261
|
271
|
and t.org_id = #{orgId}
|
|
272
|
+ group by t.target_id
|
262
|
273
|
and t.`event` = 'share'
|
263
|
|
- order by t.visit_time desc
|
264
|
274
|
|
265
|
275
|
union all
|
266
|
276
|
|
267
|
277
|
select
|
268
|
|
- f.share_img as drainage_img,
|
269
|
|
- f.`name` as drainage_name,
|
|
278
|
+ f.share_img as activity_img,
|
|
279
|
+ f.`name` as activity_name,
|
270
|
280
|
'1' as price,
|
271
|
281
|
'2' as building_name,
|
272
|
282
|
'3' as address,
|
273
|
|
- t.event_type
|
|
283
|
+ t.event_type,
|
|
284
|
+ t.visit_time
|
274
|
285
|
from ta_person_visit_record t
|
275
|
286
|
left join ta_drainage f on t.target_id = f.drainage_id
|
276
|
287
|
where t.event_type = 'h5'
|
277
|
288
|
and t.consultant_id = #{userId}
|
278
|
289
|
and t.org_id = #{orgId}
|
279
|
290
|
and t.`event` = 'share'
|
280
|
|
- order by t.visit_time desc
|
|
291
|
+ group by t.target_id ) t order by t.visit_time desc
|
281
|
292
|
</select>
|
282
|
293
|
|
283
|
294
|
<select id="countShareNumByEventType" resultType="java.lang.Integer">
|