TaRaiseRecordMapper.xml 8.0KB

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