TaHousingResourcesMapper.xml 3.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  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.TaHousingResourcesMapper">
  4. <select id="listHousingResources" resultType="com.huiju.estateagents.po.TaHousingResourcesPO">
  5. SELECT
  6. t.house_id,
  7. t.building_id,
  8. t.block_id,
  9. t.block_name,
  10. t.sales_batch_id,
  11. t.unit_id,
  12. t.unit_name,
  13. t.floor_id,
  14. t.floor_name,
  15. t.room_id,
  16. t.room_name,
  17. t.price,
  18. t.heat,
  19. t.apartment_id,
  20. t.`status`,
  21. t.org_id,
  22. t2.inside_area,
  23. t2.building_area
  24. FROM
  25. ta_housing_resources t,
  26. ta_building_apartment t2
  27. WHERE
  28. t.sales_batch_id = #{salesBatchId}
  29. <if test="startPrice != null and startPrice != '' and endPrice != null and endPrice != ''">
  30. AND ( t.price BETWEEN #{startPrice} AND #{endPrice} )
  31. </if>
  32. <if test="apartmentId != null and apartmentId != ''">
  33. AND t.apartment_id = #{apartmentId}
  34. </if>
  35. AND t.apartment_id = t2.apartment_id
  36. AND t.`status` = 1
  37. AND t2.`status` = 1
  38. ORDER BY
  39. t.create_date DESC
  40. </select>
  41. <select id="listBuildApartmentBySalesBatchId" resultType="com.huiju.estateagents.entity.TaBuildingApartment">
  42. SELECT
  43. t3.apartment_id,
  44. t3.apartment_name,
  45. t3.apartment_type,
  46. t3.inside_area,
  47. t3.building_area
  48. FROM
  49. ( SELECT t.sales_batch_id, t.apartment_id FROM ta_housing_resources t WHERE t.sales_batch_id = #{salesBatchId} GROUP BY t.apartment_id ) t2
  50. LEFT JOIN ta_building_apartment t3 ON t2.apartment_id = t3.apartment_id
  51. ORDER BY
  52. t3.apartment_name
  53. </select>
  54. <update id="updateForAddHeat" parameterType="java.lang.String">
  55. UPDATE ta_housing_resources t
  56. SET t.heat = t.heat + 1
  57. WHERE
  58. t.house_id = #{houseId}
  59. AND t.heat >= 0
  60. </update>
  61. <update id="updateForSubtractHeat" parameterType="java.lang.String">
  62. UPDATE ta_housing_resources t
  63. SET t.heat = t.heat - 1
  64. WHERE
  65. t.house_id = #{houseId}
  66. AND t.heat > 0
  67. </update>
  68. <select id="getHousingDetailById" resultType="com.huiju.estateagents.po.TaHousingResourcesPO">
  69. SELECT
  70. t.house_id,
  71. t.building_id,
  72. t.block_id,
  73. t.block_name,
  74. t.sales_batch_id,
  75. t.unit_id,
  76. t.unit_name,
  77. t.floor_id,
  78. t.floor_name,
  79. t.room_id,
  80. t.room_name,
  81. t.price,
  82. t.heat,
  83. t.apartment_id,
  84. t.`status`,
  85. t.org_id,
  86. t2.inside_area,
  87. t2.building_area
  88. FROM
  89. ta_housing_resources t,
  90. ta_building_apartment t2
  91. WHERE
  92. t.house_id = #{houseId}
  93. AND t.apartment_id = t2.apartment_id
  94. AND t.`status` = 1
  95. AND t2.`status` = 1
  96. </select>
  97. </mapper>