TaPreselectionRecordMapper.xml 2.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  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.TaPreselectionRecordMapper">
  4. <select id="listPreselectionRecord" resultType="com.huiju.estateagents.po.TaPreselectionRecordPO">
  5. SELECT
  6. t3.*,
  7. t4.building_name,
  8. t5.`status` saleBatchStatus
  9. FROM
  10. (
  11. SELECT
  12. t.preselection_record_id,
  13. t.person_id,
  14. t.org_id,
  15. t.house_id,
  16. t.`status`,
  17. t.create_date,
  18. t2.block_name,
  19. t2.unit_name,
  20. t2.floor_name,
  21. t2.room_name,
  22. t2.price,
  23. t2.apartment_id,
  24. t2.building_id buildingId,
  25. t2.`status` housingStatus,
  26. t2.sales_batch_id saleBatchId
  27. FROM
  28. ta_preselection_record t,
  29. ta_housing_resources t2
  30. WHERE
  31. t.person_id = #{personId}
  32. AND t.org_id = #{orgId}
  33. AND t.house_id = t2.house_id
  34. ORDER BY
  35. t.create_date DESC
  36. ) t3
  37. LEFT JOIN ta_building t4 ON t3.buildingId = t4.building_id
  38. LEFT JOIN ta_sales_batch t5 ON t3.saleBatchId = t5.sales_batch_id
  39. </select>
  40. <select id="getRecordByPersonIdAndHouseId" resultType="com.huiju.estateagents.entity.TaPreselectionRecord">
  41. SELECT
  42. t.*
  43. FROM
  44. ta_preselection_record t
  45. WHERE
  46. t.person_id = #{personId}
  47. AND t.house_id = #{houseId}
  48. </select>
  49. <select id="selectPreSelectRecordList" resultType="com.huiju.estateagents.po.TaPreselectionRecordPO">
  50. select t.house_id,
  51. a.block_id as blockName,
  52. a.unit_id as unitName,
  53. a.floor_id as floorName,
  54. a.room_id as roomName,
  55. a.apartment_id,
  56. b.nickname as nameOrnick,
  57. b.`name`,
  58. b.avatarurl,
  59. b.phone,
  60. t.`status`,
  61. t.update_date,
  62. (select name from ta_person t where (t.user_id = t.update_user || t.person_id = t.update_user)) as updateName
  63. from ta_preselection_record t
  64. left join ta_housing_resources a on t.house_id = a.house_id
  65. left join ta_person b on t.person_id = b.person_id
  66. where b.org_id = #{orgId} and a.sales_batch_id = #{salesBatchId}
  67. <if test="houseId != null and houseId !=''">
  68. and t.house_id = #{houseId}
  69. </if>
  70. <if test="phone != null and phone != ''">
  71. and b.phone = #{phone}
  72. </if>
  73. <if test="apartmentId != null and apartmentId != ''">
  74. and a.apartment_id = #{apartmentId}
  75. </if>
  76. <if test="status != null">
  77. and t.status = #{status}
  78. </if>
  79. </select>
  80. </mapper>