RentalProjectDao.xml 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  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="platform.modules.carrier.dao.RentalProjectDao">
  4. <select id="findList" resultType="platform.modules.carrier.entity.RentalProject">
  5. SELECT
  6. ren.id,
  7. ren.intention_street,
  8. ren.project_name,
  9. ren.demand,
  10. ren.demand_area,
  11. ren.demand_price,
  12. ren.floor,
  13. ren.create_time,
  14. ren.create_by,
  15. street.id street_id,
  16. street.name street_name
  17. FROM
  18. ic_rental_project ren
  19. LEFT JOIN z_user user ON user .id = ren.create_by
  20. LEFT JOIN y_company company ON company.id = user.company_id
  21. LEFT JOIN s_street street ON street.id = ren.intention_street
  22. WHERE
  23. ren.del_flag != 1
  24. AND ren.status = 1
  25. <if test="param.streets != null and param.streets.size()>0">
  26. AND
  27. ren.intention_street IN
  28. <foreach item="item" index="index" collection="param.streets" open="(" separator="," close=")">
  29. #{item}
  30. </foreach>
  31. </if>
  32. <if test="param.industries != null and param.industries.size()>0">
  33. AND
  34. company.industry_code IN
  35. <foreach item="item" index="index" collection="param.industries" open="(" separator="," close=")">
  36. #{item}
  37. </foreach>
  38. </if>
  39. <if test="param.demands != null and param.demands.size()>0">
  40. AND
  41. ren.demand IN
  42. <foreach item="item" index="index" collection="param.demands" open="(" separator="," close=")">
  43. #{item}
  44. </foreach>
  45. </if>
  46. <if test="param.title != null and param.title != '' ">
  47. AND (
  48. ren.project_name LIKE CONCAT('%',#{param.title},'%')
  49. OR company.company_name LIKE CONCAT('%',#{param.title},'%')
  50. )
  51. </if>
  52. <if test="param.industry_code != null and param.industry_code != '' ">
  53. AND company.industry_code = #{param.industry_code}
  54. </if>
  55. <if test="param.demand != null and param.demand != '' ">
  56. AND ren.demand = #{param.demand}
  57. </if>
  58. <if test="param.min_area != null and param.min_area != '' ">
  59. AND ren.demand_area <![CDATA[>=]]> #{param.min_area}
  60. </if>
  61. <if test="param.max_area != null and param.max_area != '' ">
  62. AND ren.demand_area <![CDATA[<=]]> #{param.max_area}
  63. </if>
  64. <if test="param.min_price != null and param.min_price != '' ">
  65. AND ren.demand_price <![CDATA[>=]]> #{param.min_price}
  66. </if>
  67. <if test="param.max_price != null and param.max_price != '' ">
  68. AND ren.demand_price <![CDATA[<=]]> #{param.max_price}
  69. </if>
  70. <if test="param.order_by != null and param.order_by != '' ">
  71. <if test="param.order_by == null or param.order_by == '' ">
  72. ORDER BY
  73. ren.create_time DESC
  74. </if>
  75. <if test="param.order_by == 1 ">
  76. ORDER BY
  77. ren.create_time DESC
  78. </if>
  79. <if test="param.order_by == 2 ">
  80. ORDER BY
  81. ren.read_count DESC
  82. </if>
  83. </if>
  84. </select>
  85. <select id="findListByCreater" resultType="platform.modules.carrier.entity.RentalProject">
  86. SELECT
  87. ren.id,
  88. ren.intention_street,
  89. ren.project_name,
  90. ren.demand,
  91. ren.demand_area,
  92. ren.demand_area_min,
  93. ren.demand_area_max,
  94. ren.floor,
  95. ren.create_time,
  96. ren.create_by,
  97. ren.status
  98. FROM
  99. ic_rental_project ren
  100. LEFT JOIN ic_rental_project_company rpc ON rpc.rental_id = ren.id
  101. WHERE
  102. ren.del_flag != 1
  103. AND
  104. ren.create_by = #{userId}
  105. <if test="param.title != null and param.title != '' ">
  106. AND ren.project_name LIKE CONCAT('%',#{param.title},'%')
  107. </if>
  108. <if test="param.min_area != null and param.min_area != ''">
  109. AND ren.demand_area_min >= #{param.min_area}
  110. </if>
  111. <if test="param.max_area != null and param.max_area != ''">
  112. AND ren.demand_area_max <![CDATA[ <= ]]> #{param.max_area}
  113. </if>
  114. <if test="param.min_price != null and param.min_price != ''">
  115. AND ren.demand_price >= #{param.min_price}
  116. </if>
  117. <if test="param.max_price != null and param.max_price != ''">
  118. AND ren.demand_price <![CDATA[ <= ]]> #{param.max_price}
  119. </if>
  120. <if test="param.demand != null and param.demand != ''">
  121. AND ren.demand = #{param.demand}
  122. </if>
  123. <if test="param.industries != null and param.industries.size() > 0">
  124. AND rpc.industry_code IN
  125. <foreach collection="param.industries" item="item" open="(" separator="," close=")">
  126. #{item}
  127. </foreach>
  128. </if>
  129. ORDER BY ren.create_time DESC
  130. </select>
  131. <update id="updateStatusBatch" parameterType="java.util.List">
  132. update ic_rental_project
  133. SET status = #{status}
  134. WHERE
  135. <if test="idList.size > 0 ">
  136. id in
  137. <foreach collection="idList" open="(" close=")" separator="," item="id">
  138. #{id}
  139. </foreach>
  140. </if>
  141. </update>
  142. </mapper>