|
@@ -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
|
|
|
@@ -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">
|