|
@@ -282,32 +282,85 @@ FROM
|
282
|
282
|
FROM
|
283
|
283
|
ta_recommend_customer a
|
284
|
284
|
LEFT JOIN ta_person b ON a.realty_consultant = b.person_id
|
|
285
|
+ LEFT JOIN ta_building c ON a.building_id = c.building_id
|
285
|
286
|
<where>
|
286
|
287
|
a.status > 0
|
287
|
288
|
and a.report_recommend_status = 1
|
288
|
289
|
<if test="orgId != null">
|
289
|
290
|
and a.org_id = #{orgId}
|
290
|
291
|
</if>
|
|
292
|
+ <if test="building != null and building !=''">
|
|
293
|
+ and a.building_id = #{building}
|
|
294
|
+ </if>
|
|
295
|
+ <if test="name != null and name !=''">
|
|
296
|
+ and a.name = #{name}
|
|
297
|
+ </if>
|
|
298
|
+ <if test="tel != null and tel!=''">
|
|
299
|
+ and a.phone like concat(concat("%",#{tel}),"%")
|
|
300
|
+ </if>
|
|
301
|
+ <if test="consultName != null and consultName !=''">
|
|
302
|
+ and b.name like CONCAT('%',#{consultName}, '%')
|
|
303
|
+ </if>
|
|
304
|
+ <if test="consultTel != null and consultTel !=''">
|
|
305
|
+ and b.tel = #{consultTel}
|
|
306
|
+ </if>
|
|
307
|
+ <if test="entryType != null and entryType !=''">
|
|
308
|
+ and a.entry_type = #{entryType}
|
|
309
|
+ </if>
|
|
310
|
+ <if test="verifyStatus != null and verifyStatus !=''">
|
|
311
|
+ and a.verify_status = #{verifyStatus}
|
|
312
|
+ </if>
|
|
313
|
+ <if test="sex != null and sex !=''">
|
|
314
|
+ and a.sex = #{sex}
|
|
315
|
+ and a.org_id = #{orgid}
|
|
316
|
+ </if>
|
291
|
317
|
</where>
|
|
318
|
+ order by a.create_date desc
|
292
|
319
|
</select>
|
293
|
320
|
|
294
|
321
|
<select id="getRepCustomerReportExport" resultType="com.huiju.estateagents.excel.ReporRecommendCustomer" >
|
295
|
322
|
SELECT
|
296
|
323
|
a.name as name,
|
297
|
324
|
a.phone as phone,
|
298
|
|
- a.intention as intention,
|
|
325
|
+ c.building_name as intentionName,
|
299
|
326
|
if(a.sex = 1, '男',if(a.sex = 2, '女', '未知')) as sex,
|
300
|
327
|
b.NAME AS consultantName,
|
301
|
328
|
b.tel AS consultTel
|
302
|
329
|
FROM
|
303
|
330
|
ta_recommend_customer a
|
304
|
331
|
LEFT JOIN ta_person b ON a.realty_consultant = b.person_id
|
|
332
|
+ LEFT JOIN ta_building c ON a.building_id = c.building_id
|
305
|
333
|
<where>
|
306
|
334
|
a.status > 0
|
307
|
335
|
and a.report_recommend_status = 1
|
308
|
336
|
<if test="orgId != null">
|
309
|
337
|
and a.org_id = #{orgId}
|
310
|
338
|
</if>
|
|
339
|
+ <if test="building != null and building !=''">
|
|
340
|
+ and a.building_id = #{building}
|
|
341
|
+ </if>
|
|
342
|
+ <if test="name != null and name !=''">
|
|
343
|
+ and a.name = #{name}
|
|
344
|
+ </if>
|
|
345
|
+ <if test="tel != null and tel!=''">
|
|
346
|
+ and a.phone like concat(concat("%",#{tel}),"%")
|
|
347
|
+ </if>
|
|
348
|
+ <if test="consultName != null and consultName !=''">
|
|
349
|
+ and b.name like CONCAT('%',#{consultName}, '%')
|
|
350
|
+ </if>
|
|
351
|
+ <if test="consultTel != null and consultTel !=''">
|
|
352
|
+ and b.tel = #{consultTel}
|
|
353
|
+ </if>
|
|
354
|
+ <if test="entryType != null and entryType !=''">
|
|
355
|
+ and a.entry_type = #{entryType}
|
|
356
|
+ </if>
|
|
357
|
+ <if test="verifyStatus != null and verifyStatus !=''">
|
|
358
|
+ and a.verify_status = #{verifyStatus}
|
|
359
|
+ </if>
|
|
360
|
+ <if test="sex != null and sex !=''">
|
|
361
|
+ and a.sex = #{sex}
|
|
362
|
+ and a.org_id = #{orgid}
|
|
363
|
+ </if>
|
311
|
364
|
</where>
|
312
|
365
|
order by a.create_date desc
|
313
|
366
|
limit #{pageCode}, #{pageSize}
|