123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184 |
- <?xml version="1.0" encoding="UTF-8"?>
- <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
- <mapper namespace="com.huiju.estateagents.mapper.TaRecommendCustomerMapper">
- <select id="getMyCutsomerNum" resultType="int">
- SELECT
- count(*) AS total
- FROM
- ta_recommend_customer t
- WHERE
- t.recommend_person = #{personId}
- AND t.status > -1
- </select>
- <select id="getCustomerPersonId" resultType="java.lang.String">
- SELECT
- person_id
- FROM
- ta_customer_person
- WHERE
- customer_id = #{customerId}
- </select>
-
- <select id="getCustomerDetail" resultType="com.huiju.estateagents.entity.TaRecommendCustomer">
- SELECT
- a.*,
- (select c.visit_time FROM ta_person_visit_record c where c.person_id = #{personId} ORDER BY c.visit_time desc LIMIT 1) as visitTime,
- (SELECT SUM(d.visit_duration) FROM ta_person_visit_record d WHERE d.person_id= #{personId}) as duration
- FROM
- ta_recommend_customer a
- LEFT JOIN ta_person_visit_record c ON a.person_id = c.person_id
- where a.customer_id = #{customerId}
- GROUP BY a.customer_id
- </select>
-
- <select id="getRecCustomerList" resultType="com.huiju.estateagents.entity.TaRecommendCustomer">
- SELECT
- a.*,
- a.customer_id as customerId,
- c.phone as recommendTel,
- c.nickname as recommendName
- FROM
- ta_recommend_customer a
- LEFT JOIN ta_person c on a.recommend_person = c.person_id
- <where>
- a.status > 0
- and a.report_recommend_status = 2
- <if test="building != null and building !=''">
- and a.building_id = #{building}
- </if>
- <if test="name != null and name !=''">
- and a.name = #{name}
- </if>
- <if test="tel != null and tel!=''">
- and a.phone = #{tel}
- </if>
- <if test="consultName != null and consultName !=''">
- and c.nickname like CONCAT('%',#{consultName}, '%')
- </if>
- <if test="consultTel != null and consultTel !=''">
- and c.phone = #{consultTel}
- </if>
- <if test="entryType != null and entryType !=''">
- and a.entry_type = #{entryType}
- </if>
- <if test="verifyStatus != null and verifyStatus !=''">
- and a.verify_status = #{verifyStatus}
- </if>
- <if test="sex != null and sex !=''">
- and a.sex = #{sex}
- </if>
- </where>
- order by a.create_date desc
- </select>
-
- <select id="getIndependentAgents" resultType="com.huiju.estateagents.entity.TaPerson">
- SELECT
- a.*
- FROM
- ta_person a
- <where>
- a.person_type = 'estate agent'
- and a.status >0
- <if test="name != null and name !=''">
- and a.nickname = #{name}
- </if>
- <if test="tel != null and tel!=''">
- and a.phone = #{tel}
- </if>
-
- </where>
-
- ORDER BY
- create_date DESC
- </select>
-
- <select id="getRepCustomerList" resultType="com.huiju.estateagents.entity.TaRecommendCustomer">
- SELECT
- a.*,
- a.customer_id AS customerId,
- b.NAME AS consultantName,
- b.tel AS consultTel
- FROM
- ta_recommend_customer a
- LEFT JOIN ta_person b ON a.realty_consultant = b.person_id
- <where>
- a.status > 0
- and a.report_recommend_status = 1
- <if test="building != null and building !=''">
- and a.building_id = #{building}
- </if>
- <if test="name != null and name !=''">
- and a.name = #{name}
- </if>
- <if test="tel != null and tel!=''">
- and a.phone = #{tel}
- </if>
- <if test="consultName != null and consultName !=''">
- and b.name like CONCAT('%',#{consultName}, '%')
- </if>
- <if test="consultTel != null and consultTel !=''">
- and b.tel = #{consultTel}
- </if>
- <if test="entryType != null and entryType !=''">
- and a.entry_type = #{entryType}
- </if>
- <if test="verifyStatus != null and verifyStatus !=''">
- and a.verify_status = #{verifyStatus}
- </if>
- <if test="sex != null and sex !=''">
- and a.sex = #{sex}
- </if>
- </where>
- order by a.create_date desc
- </select>
- <select id="getCustomerList" resultType="com.huiju.estateagents.entity.TaRecommendCustomer">
- SELECT
- a.*,
- a.customer_id as customerId,
- b.name as consultantName,
- b.tel as consultTel,
- c.nickname as recommendName,
- c.tel as recommendTel
- FROM
- ta_recommend_customer a
- LEFT JOIN ta_person b ON a.realty_consultant = b.person_id
- LEFT JOIN ta_person c on a.recommend_person = c.person_id
- <where>
- a.status > 0
- <if test="building != null and building !=''">
- and a.building_id = #{building}
- </if>
- <if test="name != null and name !=''">
- and a.name = #{name}
- </if>
- <if test="tel != null and tel!=''">
- and a.phone = #{tel}
- </if>
- <if test="consultName != null and consultName !=''">
- and b.name like CONCAT('%',#{consultName}, '%')
- </if>
- <if test="consultTel != null and consultTel !=''">
- and b.tel = #{consultTel}
- </if>
- <if test="entryType != null and entryType !=''">
- and a.entry_type = #{entryType}
- </if>
- <if test="verifyStatus != null and verifyStatus !=''">
- and a.verify_status = #{verifyStatus}
- </if>
- <if test="sex != null and sex !=''">
- and a.sex = #{sex}
- </if>
- </where>
- order by a.create_date desc
- </select>
- <select id="getCustomerById" resultType="com.huiju.estateagents.entity.TaRecommendCustomer">
- SELECT
- a.*,
- b.name as consultantName
- FROM
- ta_recommend_customer a
- LEFT JOIN ta_person b ON a.realty_consultant = b.person_id
- WHERE a.customer_id = #{customerId}
- </select>
- </mapper>
|