TaRaiseRecordMapper.xml 8.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
  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.TaRaiseRecordMapper">
  4. <select id="listHousingRaiseByCondition" resultType="com.huiju.estateagents.po.TaHousingResourcesPO">
  5. SELECT
  6. t.*,
  7. t4.apartment_name,
  8. t2.raise_record_id,
  9. t5.user_name updateName
  10. FROM
  11. ta_housing_resources t
  12. LEFT JOIN ta_raise_house t2 ON t.house_id = t2.house_id
  13. LEFT JOIN ta_raise_record t3 ON t2.raise_record_id = t3.raise_record_id
  14. LEFT JOIN ta_building_apartment t4 ON t.apartment_id = t4.apartment_id
  15. LEFT JOIN ta_user t5 ON t5.user_id = t.update_user
  16. WHERE
  17. t.org_id = #{bo.orgId}
  18. AND t.`status` != - 1
  19. <if test="bo.salesBatchId != null and bo.salesBatchId != ''">
  20. AND t.sales_batch_id = #{bo.salesBatchId}
  21. </if>
  22. <if test="bo.termName != null and bo.termName != ''">
  23. AND t.term_name like CONCAT('%',#{bo.termName}, '%')
  24. </if>
  25. <if test="bo.blockName != null and bo.blockName != ''">
  26. AND t.block_name like CONCAT('%',#{bo.blockName}, '%')
  27. </if>
  28. <if test="bo.unitName != null and bo.unitName != ''">
  29. AND t.unit_name like CONCAT('%',#{bo.unitName}, '%')
  30. </if>
  31. <if test="bo.floorName != null and bo.floorName != ''">
  32. AND t.floor_name like CONCAT('%',#{bo.floorName}, '%')
  33. </if>
  34. <if test="bo.roomName != null and bo.roomName != ''">
  35. AND t.room_name like CONCAT('%',#{bo.roomName}, '%')
  36. </if>
  37. <if test="bo.status != null">
  38. AND t.`status` = #{bo.status}
  39. </if>
  40. <if test="bo.lockingStatus != null">
  41. AND t.house_locking_status = #{bo.lockingStatus}
  42. </if>
  43. <if test="bo.apartmentId != null and bo.apartmentId != ''">
  44. AND t.apartment_id = #{bo.apartmentId}
  45. </if>
  46. <if test="bo.houseId != null">
  47. AND t.house_id = #{bo.houseId}
  48. </if>
  49. GROUP BY
  50. t.house_id
  51. ORDER BY
  52. t.raise_real_heat DESC
  53. </select>
  54. <select id="listRaiseRecordByCondition" resultType="com.huiju.estateagents.entity.TaRaiseRecord">
  55. SELECT
  56. t.*,
  57. t3.house_id,
  58. t3.term_name,
  59. t3.block_name,
  60. t3.unit_name,
  61. t3.floor_name,
  62. t3.room_name,
  63. t3.apartment_id,
  64. t4.apartment_name,
  65. t5.tel personTel,
  66. t5.nickname,
  67. t5.avatarurl
  68. FROM
  69. ta_raise_record t
  70. LEFT JOIN ta_raise_house t2 ON t.raise_record_id = t2.raise_record_id
  71. LEFT JOIN ta_housing_resources t3 ON t2.house_id = t3.house_id
  72. LEFT JOIN ta_building_apartment t4 ON t3.apartment_id = t4.apartment_id
  73. LEFT JOIN ta_person t5 ON t.person_id = t5.person_id
  74. WHERE
  75. t.org_id = #{bo.orgId}
  76. AND t.`status` != - 1
  77. AND t3.`status` != - 1
  78. <if test="bo.raiseId != null and bo.raiseId != ''">
  79. AND t.raise_id =#{bo.raiseId}
  80. </if>
  81. <if test="bo.houseId != null and bo.houseId != ''">
  82. AND t3.house_id = =#{bo.houseId}
  83. </if>
  84. <if test="bo.raiseRecordId != null and bo.raiseRecordId != ''">
  85. AND t.raise_record_id = #{bo.raiseRecordId}
  86. </if>
  87. <if test="bo.termName != null and bo.termName != ''">
  88. AND t3.term_name like CONCAT('%',#{bo.termName}, '%')
  89. </if>
  90. <if test="bo.blockName != null and bo.blockName != ''">
  91. AND t3.block_name like CONCAT('%',#{bo.blockName}, '%')
  92. </if>
  93. <if test="bo.unitName != null and bo.unitName != ''">
  94. AND t3.unit_name like CONCAT('%',#{bo.unitName}, '%')
  95. </if>
  96. <if test="bo.floorName != null and bo.floorName != ''">
  97. AND t3.floor_name like CONCAT('%',#{bo.floorName}, '%')
  98. </if>
  99. <if test="bo.roomName != null and bo.roomName != ''">
  100. AND t3.room_name like CONCAT('%',#{bo.roomName}, '%')
  101. </if>
  102. <if test="bo.status != null">
  103. AND t.status = #{bo.status}
  104. </if>
  105. <if test="bo.lockingStatus != null and bo.lockingStatus != ''">
  106. AND t.house_locking_status = #{bo.lockingStatus}
  107. </if>
  108. <if test="bo.tel != null and bo.tel != ''">
  109. AND t.tel like CONCAT('%',#{bo.tel} , '%')
  110. </if>
  111. <if test="bo.personTel != null and bo.personTel != ''">
  112. AND t5.tel like CONCAT('%',#{bo.personTel} , '%')
  113. </if>
  114. <if test="bo.payStatus != null and bo.payStatus != ''">
  115. AND t.pay_status = #{bo.payStatus}
  116. </if>
  117. <if test="bo.payType != null and bo.payType != ''">
  118. AND t.pay_type = #{bo.payType}
  119. </if>
  120. <if test = "bo.startTime != null and bo.startTime != ''">
  121. AND t.create_date &gt;= STR_TO_DATE(#{bo.startTime}, '%Y-%m-%d %H:%i:%s')
  122. </if>
  123. <if test = "bo.endTime != null and bo.endTime != ''">
  124. AND t.create_date &lt;= STR_TO_DATE(#{bo.endTime}, '%Y-%m-%d %H:%i:%s')
  125. </if>
  126. GROUP BY
  127. t2.raise_record_id
  128. ORDER BY
  129. t.create_date DESC
  130. </select>
  131. <select id ="listRaiseOrderByCondition" resultType="com.huiju.estateagents.entity.TaRaiseRecord">
  132. SELECT
  133. t.*,
  134. t2.order_id,
  135. t2.pay_time,
  136. t2.trade_no,
  137. t2.transaction_id,
  138. t2.refund_no,
  139. t2.total_fee
  140. FROM
  141. ta_raise_record t
  142. INNER JOIN ta_order t2 ON t.order_id = t2.order_id
  143. LEFT JOIN ta_person t3 ON t2.person_id = t3.person_id
  144. WHERE
  145. t.org_id = #{bo.orgId}
  146. AND t.`status` != - 1
  147. <if test = "bo.raiseId != null and bo.raiseId != ''">
  148. AND t.raise_id = #{bo.raiseId}
  149. </if>
  150. <if test = "bo.orderId != null and bo.orderId != ''">
  151. AND t2.order_id = #{bo.orderId}
  152. </if>
  153. <if test = "bo.raiseRecordId != null and bo.raiseRecordId != ''">
  154. AND t.raise_record_id = #{bo.raiseRecordId}
  155. </if>
  156. <if test = "bo.tel != null and bo.tel != ''">
  157. AND t.tel like CONCAT('%',#{bo.tel} , '%')
  158. </if>
  159. <if test = "bo.personTel != null and bo.personTel != ''">
  160. AND t3.tel like CONCAT('%',#{bo.personTel} , '%')
  161. </if>
  162. <if test = "bo.transactionId != null and bo.transactionId != ''">
  163. AND t2.transaction_id = #{bo.transactionId}
  164. </if>
  165. <if test = "bo.refundNo != null and bo.refundNo != ''">
  166. AND t2.refund_no = #{bo.refundNo}
  167. </if>
  168. <if test = "bo.payStatus != null and bo.payStatus != ''">
  169. AND t.pay_status = #{bo.payStatus}
  170. </if>
  171. <if test = "bo.payStartTime != null and bo.payStartTime != ''">
  172. AND t2.pay_time &gt;= STR_TO_DATE(#{bo.payStartTime}, '%Y-%m-%d %H:%i:%s')
  173. </if>
  174. <if test = "bo.payEndTime != null and bo.payEndTime != ''">
  175. AND t2.pay_time &lt;= STR_TO_DATE(#{bo.payEndTime}, '%Y-%m-%d %H:%i:%s')
  176. </if>
  177. ORDER BY
  178. t.create_date DESC
  179. </select>
  180. <select id="getUserInfo" resultType="com.huiju.estateagents.entity.TaRaiseRecord">
  181. select a.nickname as nickname, a.`name` as name, a.phone as personTel, t.tel, t.idcard from ta_raise_record t
  182. left join ta_person a on t.person_id = a.person_id
  183. where
  184. t.raise_record_id = #{raiseRecordId} and t.org_id = #{orgId}
  185. </select>
  186. <update id="addHouseNum">
  187. UPDATE ta_raise_record t
  188. SET t.house_num = IFNULL ( t.house_num, 0 ) + 1,
  189. t.update_date = now( ),
  190. t.update_user_name = #{updateUserName}
  191. WHERE
  192. t.raise_record_id = #{raiseRecordId}
  193. AND t.org_id = #{orgId}
  194. AND t.`status` != -1
  195. </update>
  196. </mapper>