RoomServiceDaoImplMapper.xml 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389
  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="roomServiceDaoImpl">
  6. <!-- 保存小区房屋信息 add by wuxw 2018-07-03 -->
  7. <insert id="saveBusinessRoomInfo" parameterType="Map">
  8. insert into business_building_room(
  9. unit_price,section,remark,user_id,room_id,layer,built_up_area,operate,room_num,unit_id,b_id,apartment,state
  10. ) values (
  11. #{unitPrice},#{section},#{remark},#{userId},#{roomId},#{layer},#{builtUpArea},#{operate},#{roomNum},#{unitId},#{bId},#{apartment},#{state}
  12. )
  13. </insert>
  14. <!-- 查询小区房屋信息(Business) add by wuxw 2018-07-03 -->
  15. <select id="getBusinessRoomInfo" parameterType="Map" resultType="Map">
  16. select t.unit_price,t.unit_price unitPrice,t.section,t.remark,t.user_id,t.user_id userId,t.room_id,t.room_id roomId,t.layer,t.built_up_area,t.built_up_area builtUpArea,t.operate,t.room_num,t.room_num roomNum,t.unit_id,t.unit_id unitId,t.b_id,t.b_id bId,t.apartment,t.state
  17. from business_building_room t
  18. where 1 =1
  19. <if test="unitPrice !=null and unitPrice != ''">
  20. and t.unit_price= #{unitPrice}
  21. </if>
  22. <if test="section !=null and section != ''">
  23. and t.section= #{section}
  24. </if>
  25. <if test="remark !=null and remark != ''">
  26. and t.remark= #{remark}
  27. </if>
  28. <if test="userId !=null and userId != ''">
  29. and t.user_id= #{userId}
  30. </if>
  31. <if test="roomId !=null and roomId != ''">
  32. and t.room_id= #{roomId}
  33. </if>
  34. <if test="layer !=null and layer != ''">
  35. and t.layer= #{layer}
  36. </if>
  37. <if test="builtUpArea !=null and builtUpArea != ''">
  38. and t.built_up_area= #{builtUpArea}
  39. </if>
  40. <if test="operate !=null and operate != ''">
  41. and t.operate= #{operate}
  42. </if>
  43. <if test="roomNum !=null and roomNum != ''">
  44. and t.room_num= #{roomNum}
  45. </if>
  46. <if test="unitId !=null and unitId != ''">
  47. and t.unit_id= #{unitId}
  48. </if>
  49. <if test="bId !=null and bId != ''">
  50. and t.b_id= #{bId}
  51. </if>
  52. <if test="apartment !=null and apartment != ''">
  53. and t.apartment= #{apartment}
  54. </if>
  55. <if test="state !=null and state != ''">
  56. and t.state= #{state}
  57. </if>
  58. </select>
  59. <!-- 保存小区房屋信息至 instance表中 add by wuxw 2018-07-03 -->
  60. <insert id="saveRoomInfoInstance" parameterType="Map">
  61. insert into building_room(
  62. unit_price,section,status_cd,remark,user_id,room_id,layer,built_up_area,room_num,unit_id,b_id,apartment,state
  63. ) select t.unit_price,t.section,'0',t.remark,t.user_id,t.room_id,t.layer,t.built_up_area,t.room_num,t.unit_id,t.b_id,t.apartment,t.state from business_building_room t where 1=1
  64. <if test="unitPrice !=null and unitPrice != ''">
  65. and t.unit_price= #{unitPrice}
  66. </if>
  67. <if test="section !=null and section != ''">
  68. and t.section= #{section}
  69. </if>
  70. <if test="remark !=null and remark != ''">
  71. and t.remark= #{remark}
  72. </if>
  73. <if test="userId !=null and userId != ''">
  74. and t.user_id= #{userId}
  75. </if>
  76. <if test="roomId !=null and roomId != ''">
  77. and t.room_id= #{roomId}
  78. </if>
  79. <if test="layer !=null and layer != ''">
  80. and t.layer= #{layer}
  81. </if>
  82. <if test="builtUpArea !=null and builtUpArea != ''">
  83. and t.built_up_area= #{builtUpArea}
  84. </if>
  85. and t.operate= 'ADD'
  86. <if test="roomNum !=null and roomNum != ''">
  87. and t.room_num= #{roomNum}
  88. </if>
  89. <if test="unitId !=null and unitId != ''">
  90. and t.unit_id= #{unitId}
  91. </if>
  92. <if test="bId !=null and bId != ''">
  93. and t.b_id= #{bId}
  94. </if>
  95. <if test="apartment !=null and apartment != ''">
  96. and t.apartment= #{apartment}
  97. </if>
  98. <if test="state !=null and state != ''">
  99. and t.state= #{state}
  100. </if>
  101. </insert>
  102. <!-- 查询小区房屋信息 add by wuxw 2018-07-03 -->
  103. <select id="getRoomInfo" parameterType="Map" resultType="Map">
  104. select t.unit_price,t.unit_price unitPrice,t.section,t.status_cd,t.status_cd statusCd,t.remark,t.user_id,t.user_id userId,t.room_id,t.room_id roomId,t.layer,t.built_up_area,t.built_up_area builtUpArea,t.room_num,t.room_num roomNum,t.unit_id,t.unit_id unitId,t.b_id,t.b_id bId,t.apartment,t.state
  105. from building_room t
  106. where 1 =1
  107. <if test="unitPrice !=null and unitPrice != ''">
  108. and t.unit_price= #{unitPrice}
  109. </if>
  110. <if test="section !=null and section != ''">
  111. and t.section= #{section}
  112. </if>
  113. <if test="statusCd !=null and statusCd != ''">
  114. and t.status_cd= #{statusCd}
  115. </if>
  116. <if test="remark !=null and remark != ''">
  117. and t.remark= #{remark}
  118. </if>
  119. <if test="userId !=null and userId != ''">
  120. and t.user_id= #{userId}
  121. </if>
  122. <if test="roomId !=null and roomId != ''">
  123. and t.room_id= #{roomId}
  124. </if>
  125. <if test="layer !=null and layer != ''">
  126. and t.layer= #{layer}
  127. </if>
  128. <if test="builtUpArea !=null and builtUpArea != ''">
  129. and t.built_up_area= #{builtUpArea}
  130. </if>
  131. <if test="roomNum !=null and roomNum != ''">
  132. and t.room_num= #{roomNum}
  133. </if>
  134. <if test="unitId !=null and unitId != ''">
  135. and t.unit_id= #{unitId}
  136. </if>
  137. <if test="bId !=null and bId != ''">
  138. and t.b_id= #{bId}
  139. </if>
  140. <if test="apartment !=null and apartment != ''">
  141. and t.apartment= #{apartment}
  142. </if>
  143. <if test="page != -1 and page != null">
  144. limit #{page},#{row}
  145. </if>
  146. <if test="state !=null and state != ''">
  147. and t.state= #{state}
  148. </if>
  149. </select>
  150. <!-- 修改小区房屋信息 add by wuxw 2018-07-03 -->
  151. <update id="updateRoomInfoInstance" parameterType="Map">
  152. update building_room t set t.status_cd = #{statusCd}
  153. <if test="newBId != null and newBId != ''">
  154. ,t.b_id = #{newBId}
  155. </if>
  156. <if test="unitPrice !=null and unitPrice != ''">
  157. , t.unit_price= #{unitPrice}
  158. </if>
  159. <if test="section !=null and section != ''">
  160. , t.section= #{section}
  161. </if>
  162. <if test="remark !=null and remark != ''">
  163. , t.remark= #{remark}
  164. </if>
  165. <if test="userId !=null and userId != ''">
  166. , t.user_id= #{userId}
  167. </if>
  168. <if test="layer !=null and layer != ''">
  169. , t.layer= #{layer}
  170. </if>
  171. <if test="builtUpArea !=null and builtUpArea != ''">
  172. , t.built_up_area= #{builtUpArea}
  173. </if>
  174. <if test="roomNum !=null and roomNum != ''">
  175. , t.room_num= #{roomNum}
  176. </if>
  177. <if test="unitId !=null and unitId != ''">
  178. , t.unit_id= #{unitId}
  179. </if>
  180. <if test="apartment !=null and apartment != ''">
  181. , t.apartment= #{apartment}
  182. </if>
  183. <if test="state !=null and state != ''">
  184. , t.state= #{state}
  185. </if>
  186. where 1=1 <if test="roomId !=null and roomId != ''">
  187. and t.room_id= #{roomId}
  188. </if>
  189. <if test="bId !=null and bId != ''">
  190. and t.b_id= #{bId}
  191. </if>
  192. </update>
  193. <!-- 查询小区房屋数量 add by wuxw 2018-07-03 -->
  194. <select id="queryRoomsCount" parameterType="Map" resultType="Map">
  195. select count(1) count
  196. from building_room t
  197. where 1 =1
  198. <if test="unitPrice !=null and unitPrice != ''">
  199. and t.unit_price= #{unitPrice}
  200. </if>
  201. <if test="section !=null and section != ''">
  202. and t.section= #{section}
  203. </if>
  204. <if test="statusCd !=null and statusCd != ''">
  205. and t.status_cd= #{statusCd}
  206. </if>
  207. <if test="remark !=null and remark != ''">
  208. and t.remark= #{remark}
  209. </if>
  210. <if test="userId !=null and userId != ''">
  211. and t.user_id= #{userId}
  212. </if>
  213. <if test="roomId !=null and roomId != ''">
  214. and t.room_id= #{roomId}
  215. </if>
  216. <if test="layer !=null and layer != ''">
  217. and t.layer= #{layer}
  218. </if>
  219. <if test="builtUpArea !=null and builtUpArea != ''">
  220. and t.built_up_area= #{builtUpArea}
  221. </if>
  222. <if test="roomNum !=null and roomNum != ''">
  223. and t.room_num= #{roomNum}
  224. </if>
  225. <if test="unitId !=null and unitId != ''">
  226. and t.unit_id= #{unitId}
  227. </if>
  228. <if test="bId !=null and bId != ''">
  229. and t.b_id= #{bId}
  230. </if>
  231. <if test="apartment !=null and apartment != ''">
  232. and t.apartment= #{apartment}
  233. </if>
  234. <if test="state !=null and state != ''">
  235. and t.state= #{state}
  236. </if>
  237. </select>
  238. <!-- 查询小区房屋数量 add by wuxw 2018-07-03 -->
  239. <select id="queryRoomsByCommunityIdCount" parameterType="Map" resultType="Map">
  240. select count(1) count
  241. FROM building_room t,s_community c,s_community_member cm,building_unit u,f_floor f
  242. WHERE 1 =1
  243. AND t.`unit_id` = u.`unit_id`
  244. AND u.`floor_id` = f.`floor_id`
  245. AND f.`floor_id` = cm.`member_id`
  246. AND cm.`community_id` = c.`community_id`
  247. AND cm.`member_type_cd` = '390001200004'
  248. AND c.`status_cd` = '0'
  249. AND cm.`status_cd` = '0'
  250. AND u.`status_cd` = '0'
  251. AND f.`status_cd` = '0'
  252. AND c.`community_id` = #{communityId}
  253. <if test="floorId !=null and floorId != ''">
  254. and f.`floor_id`= #{floorId}
  255. </if>
  256. <if test="unitPrice !=null and unitPrice != ''">
  257. and t.unit_price= #{unitPrice}
  258. </if>
  259. <if test="section !=null and section != ''">
  260. and t.section= #{section}
  261. </if>
  262. <if test="statusCd !=null and statusCd != ''">
  263. and t.status_cd= #{statusCd}
  264. </if>
  265. <if test="remark !=null and remark != ''">
  266. and t.remark= #{remark}
  267. </if>
  268. <if test="userId !=null and userId != ''">
  269. and t.user_id= #{userId}
  270. </if>
  271. <if test="roomId !=null and roomId != ''">
  272. and t.room_id= #{roomId}
  273. </if>
  274. <if test="layer !=null and layer != ''">
  275. and t.layer= #{layer}
  276. </if>
  277. <if test="builtUpArea !=null and builtUpArea != ''">
  278. and t.built_up_area= #{builtUpArea}
  279. </if>
  280. <if test="roomNum !=null and roomNum != ''">
  281. and t.room_num= #{roomNum}
  282. </if>
  283. <if test="unitId !=null and unitId != ''">
  284. and t.unit_id= #{unitId}
  285. </if>
  286. <if test="bId !=null and bId != ''">
  287. and t.b_id= #{bId}
  288. </if>
  289. <if test="apartment !=null and apartment != ''">
  290. and t.apartment= #{apartment}
  291. </if>
  292. <if test="state !=null and state != ''">
  293. and t.state= #{state}
  294. </if>
  295. </select>
  296. <!-- 查询小区房屋信息 add by wuxw 2018-07-03 -->
  297. <select id="getRoomInfoByCommunityId" parameterType="Map" resultType="Map">
  298. SELECT t.unit_price,t.unit_price unitPrice,t.section,t.status_cd,t.status_cd statusCd,t.remark,t.user_id,
  299. t.user_id userId,t.room_id,t.room_id roomId,t.layer,t.built_up_area,t.built_up_area builtUpArea,t.room_num,
  300. t.room_num roomNum,t.unit_id,t.unit_id unitId,t.b_id,t.b_id bId,t.apartment,t.state,u.`unit_num` unitNum
  301. FROM building_room t,s_community c,s_community_member cm,building_unit u,f_floor f
  302. WHERE 1 =1
  303. AND t.`unit_id` = u.`unit_id`
  304. AND u.`floor_id` = f.`floor_id`
  305. AND f.`floor_id` = cm.`member_id`
  306. AND cm.`community_id` = c.`community_id`
  307. AND cm.`member_type_cd` = '390001200004'
  308. AND c.`status_cd` = '0'
  309. AND cm.`status_cd` = '0'
  310. AND u.`status_cd` = '0'
  311. AND f.`status_cd` = '0'
  312. AND c.`community_id` = #{communityId}
  313. <if test="floorId !=null and floorId != ''">
  314. and f.`floor_id`= #{floorId}
  315. </if>
  316. <if test="unitPrice !=null and unitPrice != ''">
  317. and t.unit_price= #{unitPrice}
  318. </if>
  319. <if test="section !=null and section != ''">
  320. and t.section= #{section}
  321. </if>
  322. <if test="statusCd !=null and statusCd != ''">
  323. and t.status_cd= #{statusCd}
  324. </if>
  325. <if test="remark !=null and remark != ''">
  326. and t.remark= #{remark}
  327. </if>
  328. <if test="userId !=null and userId != ''">
  329. and t.user_id= #{userId}
  330. </if>
  331. <if test="roomId !=null and roomId != ''">
  332. and t.room_id= #{roomId}
  333. </if>
  334. <if test="layer !=null and layer != ''">
  335. and t.layer= #{layer}
  336. </if>
  337. <if test="builtUpArea !=null and builtUpArea != ''">
  338. and t.built_up_area= #{builtUpArea}
  339. </if>
  340. <if test="roomNum !=null and roomNum != ''">
  341. and t.room_num= #{roomNum}
  342. </if>
  343. <if test="unitId !=null and unitId != ''">
  344. and t.unit_id= #{unitId}
  345. </if>
  346. <if test="bId !=null and bId != ''">
  347. and t.b_id= #{bId}
  348. </if>
  349. <if test="apartment !=null and apartment != ''">
  350. and t.apartment= #{apartment}
  351. </if>
  352. <if test="state !=null and state != ''">
  353. and t.state= #{state}
  354. </if>
  355. <if test="page != -1 and page != null">
  356. limit #{page},#{row}
  357. </if>
  358. </select>
  359. </mapper>