12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970 |
- <?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.person_id = #{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 b.person_id = c.person_id ORDER BY c.visit_time desc LIMIT 1) as visitTime,
- (SELECT SUM(d.visit_duration) FROM ta_person_visit_record d WHERE b.person_id = d.person_id) as duration
- FROM
- ta_recommend_customer a
- LEFT JOIN ta_customer_person b on a.customer_id = b.customer_id
- LEFT JOIN ta_person_visit_record c ON b.person_id = c.person_id
- where a.customer_id = #{customerId}
- </select>
-
- <select id="getCustomerList" resultType="com.huiju.estateagents.entity.TaRecommendCustomer">
- SELECT
- a.*,
- 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
- <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>
- </where>
- </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>
|