RoomV1ServiceDaoImplMapper.xml 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper
  3. PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5. <mapper namespace="roomV1ServiceDaoImpl">
  6. <!-- 保存房屋信息 add by wuxw 2018-07-03 -->
  7. <insert id="saveRoomInfo" parameterType="Map">
  8. insert into building_room(
  9. section,remark,room_sub_type,room_area,user_id,room_id,layer,fee_coefficient,built_up_area,room_num,unit_id,state,community_id,apartment,room_type,room_rent
  10. ) values (
  11. #{section},#{remark},#{roomSubType},#{roomArea},#{userId},#{roomId},#{layer},#{feeCoefficient},#{builtUpArea},#{roomNum},#{unitId},#{state},#{communityId},#{apartment},#{roomType},#{roomRent}
  12. )
  13. </insert>
  14. <!-- 查询房屋信息 add by wuxw 2018-07-03 -->
  15. <select id="getRoomInfo" parameterType="Map" resultType="Map">
  16. select t.section,t.remark,t.status_cd,t.status_cd statusCd,t.room_sub_type,t.room_sub_type
  17. roomSubType,t.room_area,t.room_area roomArea,t.user_id,t.user_id userId,t.room_id,t.room_id
  18. roomId,t.layer,t.fee_coefficient,t.fee_coefficient feeCoefficient,t.built_up_area,t.built_up_area
  19. builtUpArea,t.room_num,t.room_num roomNum,t.unit_id,t.unit_id unitId,t.state,td.name stateName,t.community_id,t.community_id
  20. communityId,t.apartment,t.room_type,t.room_type roomType,t.room_rent,t.room_rent roomRent,f.floor_num floorNum,bu.unit_num unitNum
  21. from building_room t
  22. left join building_unit bu on t.unit_id = bu.unit_id and bu.status_cd = '0'
  23. left join f_floor f on bu.floor_id = f.floor_id and f.status_cd = '0'
  24. left join t_dict td on t.state = td.status_cd and td.table_name = 'building_room' and td.table_columns = 'state'
  25. where 1 =1
  26. <if test="section !=null and section != ''">
  27. and t.section= #{section}
  28. </if>
  29. <if test="remark !=null and remark != ''">
  30. and t.remark= #{remark}
  31. </if>
  32. <if test="unitId !=null and unitId != ''">
  33. and bu.unit_id= #{unitId}
  34. </if>
  35. <if test="floorId !=null and floorId != ''">
  36. and f.floor_id= #{floorId}
  37. </if>
  38. <if test="floorNum !=null and floorNum != ''">
  39. and f.`floor_num`= #{floorNum}
  40. </if>
  41. <if test="unitNum !=null and unitNum != ''">
  42. and bu.unit_num= #{unitNum}
  43. </if>
  44. <if test="floorIds !=null ">
  45. and f.floor_id in
  46. <foreach collection="floorIds" item="item" index="index" open="(" close=")" separator=",">
  47. #{item}
  48. </foreach>
  49. </if>
  50. <if test="statusCd !=null and statusCd != ''">
  51. and t.status_cd= #{statusCd}
  52. </if>
  53. <if test="roomSubType !=null and roomSubType != ''">
  54. and t.room_sub_type= #{roomSubType}
  55. </if>
  56. <if test="roomArea !=null and roomArea != ''">
  57. and t.room_area= #{roomArea}
  58. </if>
  59. <if test="communityId !=null and communityId != ''">
  60. and t.community_id= #{communityId}
  61. </if>
  62. <if test="roomId !=null and roomId != ''">
  63. and t.room_id= #{roomId}
  64. </if>
  65. <if test="roomIds != null">
  66. and t.room_id in
  67. <foreach collection="roomIds" item="item" open="(" close=")" separator=",">
  68. #{item}
  69. </foreach>
  70. </if>
  71. <if test="layer !=null and layer != ''">
  72. and t.layer= #{layer}
  73. </if>
  74. <if test="feeCoefficient !=null and feeCoefficient != ''">
  75. and t.fee_coefficient= #{feeCoefficient}
  76. </if>
  77. <if test="builtUpArea !=null and builtUpArea != ''">
  78. and t.built_up_area= #{builtUpArea}
  79. </if>
  80. <if test="roomNum !=null and roomNum != ''">
  81. and t.room_num= #{roomNum}
  82. </if>
  83. <if test="roomNumLike !=null and roomNumLike != ''">
  84. and t.room_num like concat('%',#{roomNumLike},'%')
  85. </if>
  86. <if test="unitId !=null and unitId != ''">
  87. and t.unit_id= #{unitId}
  88. </if>
  89. <if test="state !=null and state != ''">
  90. and t.state= #{state}
  91. </if>
  92. <if test="apartment !=null and apartment != ''">
  93. and t.apartment= #{apartment}
  94. </if>
  95. <if test="roomType !=null and roomType != ''">
  96. and t.room_type= #{roomType}
  97. </if>
  98. <if test="roomRent !=null and roomRent != ''">
  99. and t.room_rent= #{roomRent}
  100. </if>
  101. order by t.create_time desc
  102. <if test="page != -1 and page != null ">
  103. limit #{page}, #{row}
  104. </if>
  105. </select>
  106. <!-- 修改房屋信息 add by wuxw 2018-07-03 -->
  107. <update id="updateRoomInfo" parameterType="Map">
  108. update building_room t set t.status_cd = #{statusCd}
  109. <if test="newBId != null and newBId != ''">
  110. ,t.b_id = #{newBId}
  111. </if>
  112. <if test="section !=null and section != ''">
  113. , t.section= #{section}
  114. </if>
  115. <if test="remark !=null and remark != ''">
  116. , t.remark= #{remark}
  117. </if>
  118. <if test="roomSubType !=null and roomSubType != ''">
  119. , t.room_sub_type= #{roomSubType}
  120. </if>
  121. <if test="roomArea !=null and roomArea != ''">
  122. , t.room_area= #{roomArea}
  123. </if>
  124. <if test="userId !=null and userId != ''">
  125. , t.user_id= #{userId}
  126. </if>
  127. <if test="layer !=null and layer != ''">
  128. , t.layer= #{layer}
  129. </if>
  130. <if test="feeCoefficient !=null and feeCoefficient != ''">
  131. , t.fee_coefficient= #{feeCoefficient}
  132. </if>
  133. <if test="builtUpArea !=null and builtUpArea != ''">
  134. , t.built_up_area= #{builtUpArea}
  135. </if>
  136. <if test="roomNum !=null and roomNum != ''">
  137. , t.room_num= #{roomNum}
  138. </if>
  139. <if test="unitId !=null and unitId != ''">
  140. , t.unit_id= #{unitId}
  141. </if>
  142. <if test="state !=null and state != ''">
  143. , t.state= #{state}
  144. </if>
  145. <if test="communityId !=null and communityId != ''">
  146. , t.community_id= #{communityId}
  147. </if>
  148. <if test="apartment !=null and apartment != ''">
  149. , t.apartment= #{apartment}
  150. </if>
  151. <if test="roomType !=null and roomType != ''">
  152. , t.room_type= #{roomType}
  153. </if>
  154. <if test="roomRent !=null and roomRent != ''">
  155. , t.room_rent= #{roomRent}
  156. </if>
  157. where 1=1
  158. <if test="roomId !=null and roomId != ''">
  159. and t.room_id= #{roomId}
  160. </if>
  161. </update>
  162. <!-- 查询房屋数量 add by wuxw 2018-07-03 -->
  163. <select id="queryRoomsCount" parameterType="Map" resultType="Map">
  164. select count(1) count
  165. from building_room t
  166. left join building_unit bu on t.unit_id = bu.unit_id and bu.status_cd = '0'
  167. left join f_floor f on bu.floor_id = f.floor_id and f.status_cd = '0'
  168. where 1 =1
  169. <if test="unitId !=null and unitId != ''">
  170. and bu.unit_id= #{unitId}
  171. </if>
  172. <if test="floorId !=null and floorId != ''">
  173. and f.floor_id= #{floorId}
  174. </if>
  175. <if test="floorNum !=null and floorNum != ''">
  176. and f.`floor_num`= #{floorNum}
  177. </if>
  178. <if test="unitNum !=null and unitNum != ''">
  179. and u.unit_num= #{unitNum}
  180. </if>
  181. <if test="floorIds !=null ">
  182. and f.floor_id in
  183. <foreach collection="floorIds" item="item" index="index" open="(" close=")" separator=",">
  184. #{item}
  185. </foreach>
  186. </if>
  187. <if test="section !=null and section != ''">
  188. and t.section= #{section}
  189. </if>
  190. <if test="remark !=null and remark != ''">
  191. and t.remark= #{remark}
  192. </if>
  193. <if test="statusCd !=null and statusCd != ''">
  194. and t.status_cd= #{statusCd}
  195. </if>
  196. <if test="roomSubType !=null and roomSubType != ''">
  197. and t.room_sub_type= #{roomSubType}
  198. </if>
  199. <if test="roomArea !=null and roomArea != ''">
  200. and t.room_area= #{roomArea}
  201. </if>
  202. <if test="userId !=null and userId != ''">
  203. and t.user_id= #{userId}
  204. </if>
  205. <if test="roomId !=null and roomId != ''">
  206. and t.room_id= #{roomId}
  207. </if>
  208. <if test="roomIds != null">
  209. and t.room_id in
  210. <foreach collection="roomIds" item="item" open="(" close=")" separator=",">
  211. #{item}
  212. </foreach>
  213. </if>
  214. <if test="layer !=null and layer != ''">
  215. and t.layer= #{layer}
  216. </if>
  217. <if test="feeCoefficient !=null and feeCoefficient != ''">
  218. and t.fee_coefficient= #{feeCoefficient}
  219. </if>
  220. <if test="builtUpArea !=null and builtUpArea != ''">
  221. and t.built_up_area= #{builtUpArea}
  222. </if>
  223. <if test="roomNum !=null and roomNum != ''">
  224. and t.room_num= #{roomNum}
  225. </if>
  226. <if test="roomNumLike !=null and roomNumLike != ''">
  227. and t.room_num like concat('%',#{roomNumLike},'%')
  228. </if>
  229. <if test="unitId !=null and unitId != ''">
  230. and t.unit_id= #{unitId}
  231. </if>
  232. <if test="state !=null and state != ''">
  233. and t.state= #{state}
  234. </if>
  235. <if test="communityId !=null and communityId != ''">
  236. and t.community_id= #{communityId}
  237. </if>
  238. <if test="apartment !=null and apartment != ''">
  239. and t.apartment= #{apartment}
  240. </if>
  241. <if test="roomType !=null and roomType != ''">
  242. and t.room_type= #{roomType}
  243. </if>
  244. <if test="roomRent !=null and roomRent != ''">
  245. and t.room_rent= #{roomRent}
  246. </if>
  247. </select>
  248. </mapper>