12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- <?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.TaSharePersonFromMapper">
-
- <select id="countViewNum" resultType="java.lang.Integer">
- select count(*) from (
- select count(1) from ta_share_person_from t
- left join ta_person a on t.share_person = a.person_id
- left join ta_person b on t.share_person = b.user_id
- where
- t.share_person in (#{userId}
- <if test="personId != null and personId != ''">
- ,#{personId}
- </if>
- )
- and t.org_id = #{orgId} and t.status = 1 and t.person_id != #{personId}
- <if test="startCreateDate != null and startCreateDate != ''">
- and date_format(t.create_date,'%Y-%m-%d') >= date_format(#{startCreateDate},'%Y-%m-%d')
- </if>
- <if test="endCreateDate != null and endCreateDate != ''">
- and date_format(t.create_date,'%Y-%m-%d') <= date_format(#{endCreateDate},'%Y-%m-%d')
- </if>
- GROUP BY t.person_id
- ) t
- </select>
-
- <select id="selectHouseVisitList" resultType="com.huiju.estateagents.entity.TaSharePersonFrom">
- select c.avatarurl as photoOravatar, c.nickname as nameOrnick, c.name, c.phone, c.person_type as sharePersonType, t.create_date, b.scene_type as sceneName
- From ta_share_person_from t
- LEFT JOIN ta_person_from_record a on t.person_id = a.person_id
- left join td_wx_dict b on a.scene_id = b.scene_id
- left join ta_person c on t.person_id = c.person_id
- left join ta_housing_resources d on d.house_id = t.target_id
- left join ta_sales_batch z on t.target_id = z.sales_batch_id
- where a.org_id = #{orgId}
- and t.target_type = 'house_share'
- and z.sales_batch_id = #{saleBatchId}
- <if test="personType != null and personType != ''">
- and c.person_Type = #{personType}
- </if>
- <if test="sceneType != null and sceneType != ''">
- <choose>
- <when test="sceneType == 'share'">
- and b.scene_type like CONCAT('%', #{sceneType})
- </when>
- <otherwise>
- and b.scene_type = #{sceneType}
- </otherwise>
- </choose>
- </if>
- <if test="phone != null and phone != ''">
- and c.phone = #{phone}
- </if>
- and t.share_person != t.person_id
- GROUP BY t.target_id,t.target_type,t.person_id,t.share_person
- order by t.create_date desc
- </select>
- </mapper>
|