TaSharePersonFromMapper.xml 2.6KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3. <mapper namespace="com.huiju.estateagents.mapper.TaSharePersonFromMapper">
  4. <select id="countViewNum" resultType="java.lang.Integer">
  5. select count(*) from (
  6. select count(1) from ta_share_person_from t
  7. left join ta_person a on t.share_person = a.person_id
  8. left join ta_person b on t.share_person = b.user_id
  9. where
  10. t.share_person in (#{userId}
  11. <if test="personId != null and personId != ''">
  12. ,#{personId}
  13. </if>
  14. )
  15. and t.org_id = #{orgId} and t.status = 1 and t.person_id != #{personId}
  16. <if test="startCreateDate != null and startCreateDate != ''">
  17. and date_format(t.create_date,'%Y-%m-%d') >= date_format(#{startCreateDate},'%Y-%m-%d')
  18. </if>
  19. <if test="endCreateDate != null and endCreateDate != ''">
  20. and date_format(t.create_date,'%Y-%m-%d') &lt;= date_format(#{endCreateDate},'%Y-%m-%d')
  21. </if>
  22. GROUP BY t.person_id
  23. ) t
  24. </select>
  25. <select id="selectHouseVisitList" resultType="com.huiju.estateagents.entity.TaSharePersonFrom">
  26. 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
  27. From ta_share_person_from t
  28. LEFT JOIN ta_person_from_record a on t.person_id = a.person_id
  29. left join td_wx_dict b on a.scene_id = b.scene_id
  30. left join ta_person c on t.person_id = c.person_id
  31. left join ta_housing_resources d on d.house_id = t.target_id
  32. left join ta_sales_batch z on t.target_id = z.sales_batch_id
  33. where a.org_id = #{orgId}
  34. and t.target_type = 'house_share'
  35. and z.sales_batch_id = #{saleBatchId}
  36. <if test="personType != null and personType != ''">
  37. and c.person_Type = #{personType}
  38. </if>
  39. <if test="sceneType != null and sceneType != ''">
  40. <choose>
  41. <when test="sceneType == 'share'">
  42. and b.scene_type like CONCAT('%', #{sceneType})
  43. </when>
  44. <otherwise>
  45. and b.scene_type = #{sceneType}
  46. </otherwise>
  47. </choose>
  48. </if>
  49. <if test="phone != null and phone != ''">
  50. and c.phone = #{phone}
  51. </if>
  52. and t.share_person != t.person_id
  53. GROUP BY t.target_id,t.target_type,t.person_id,t.share_person
  54. order by t.create_date desc
  55. </select>
  56. </mapper>