RoomServiceDaoImplMapper.xml 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753
  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,community_id
  10. ) values (
  11. #{unitPrice},#{section},#{remark},#{userId},#{roomId},#{layer},#{builtUpArea},#{operate},#{roomNum},#{unitId},#{bId},#{apartment},#{state},
  12. #{communityId}
  13. )
  14. </insert>
  15. <!-- 查询小区房屋信息(Business) add by wuxw 2018-07-03 -->
  16. <select id="getBusinessRoomInfo" parameterType="Map" resultType="Map">
  17. 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
  18. roomId,t.layer,t.built_up_area,t.built_up_area builtUpArea,t.operate,t.room_num,t.room_num
  19. roomNum,t.unit_id,t.unit_id unitId,t.b_id,t.b_id bId,t.apartment,t.state,t.community_id,t.community_id
  20. communityId
  21. from business_building_room t
  22. where 1 =1
  23. <if test="unitPrice !=null and unitPrice != ''">
  24. and t.unit_price= #{unitPrice}
  25. </if>
  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="userId !=null and userId != ''">
  33. and t.user_id= #{userId}
  34. </if>
  35. <if test="roomId !=null and roomId != ''">
  36. and t.room_id= #{roomId}
  37. </if>
  38. <if test="layer !=null and layer != ''">
  39. and t.layer= #{layer}
  40. </if>
  41. <if test="builtUpArea !=null and builtUpArea != ''">
  42. and t.built_up_area= #{builtUpArea}
  43. </if>
  44. <if test="operate !=null and operate != ''">
  45. and t.operate= #{operate}
  46. </if>
  47. <if test="roomNum !=null and roomNum != ''">
  48. and t.room_num= #{roomNum}
  49. </if>
  50. <if test="unitId !=null and unitId != ''">
  51. and t.unit_id= #{unitId}
  52. </if>
  53. <if test="bId !=null and bId != ''">
  54. and t.b_id= #{bId}
  55. </if>
  56. <if test="apartment !=null and apartment != ''">
  57. and t.apartment= #{apartment}
  58. </if>
  59. <if test="state !=null and state != ''">
  60. and t.state= #{state}
  61. </if>
  62. <if test="communityId !=null and communityId != ''">
  63. and t.community_id= #{communityId}
  64. </if>
  65. </select>
  66. <!-- 保存小区房屋信息至 instance表中 add by wuxw 2018-07-03 -->
  67. <insert id="saveRoomInfoInstance" parameterType="Map">
  68. insert into building_room(
  69. unit_price,section,status_cd,remark,user_id,room_id,layer,built_up_area,room_num,unit_id,b_id,apartment,state,community_id
  70. ) select
  71. 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,t.community_id
  72. from business_building_room t where 1=1
  73. <if test="unitPrice !=null and unitPrice != ''">
  74. and t.unit_price= #{unitPrice}
  75. </if>
  76. <if test="section !=null and section != ''">
  77. and t.section= #{section}
  78. </if>
  79. <if test="remark !=null and remark != ''">
  80. and t.remark= #{remark}
  81. </if>
  82. <if test="userId !=null and userId != ''">
  83. and t.user_id= #{userId}
  84. </if>
  85. <if test="roomId !=null and roomId != ''">
  86. and t.room_id= #{roomId}
  87. </if>
  88. <if test="layer !=null and layer != ''">
  89. and t.layer= #{layer}
  90. </if>
  91. <if test="builtUpArea !=null and builtUpArea != ''">
  92. and t.built_up_area= #{builtUpArea}
  93. </if>
  94. and t.operate= 'ADD'
  95. <if test="roomNum !=null and roomNum != ''">
  96. and t.room_num= #{roomNum}
  97. </if>
  98. <if test="unitId !=null and unitId != ''">
  99. and t.unit_id= #{unitId}
  100. </if>
  101. <if test="bId !=null and bId != ''">
  102. and t.b_id= #{bId}
  103. </if>
  104. <if test="apartment !=null and apartment != ''">
  105. and t.apartment= #{apartment}
  106. </if>
  107. <if test="state !=null and state != ''">
  108. and t.state= #{state}
  109. </if>
  110. <if test="communityId !=null and communityId != ''">
  111. and t.community_id= #{communityId}
  112. </if>
  113. </insert>
  114. <!-- 查询小区房屋信息 add by wuxw 2018-07-03 -->
  115. <select id="getRoomInfo" parameterType="Map" resultType="Map">
  116. select t.unit_price,t.unit_price unitPrice,t.section,t.status_cd,t.status_cd
  117. 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
  118. builtUpArea,t.room_num,t.room_num roomNum,t.unit_id,t.unit_id unitId,t.b_id,t.b_id
  119. bId,t.apartment,t.state,t.community_id,t.community_id communityId
  120. from building_room t
  121. where 1 =1
  122. <if test="unitPrice !=null and unitPrice != ''">
  123. and t.unit_price= #{unitPrice}
  124. </if>
  125. <if test="section !=null and section != ''">
  126. and t.section= #{section}
  127. </if>
  128. <if test="statusCd !=null and statusCd != ''">
  129. and t.status_cd= #{statusCd}
  130. </if>
  131. <if test="remark !=null and remark != ''">
  132. and t.remark= #{remark}
  133. </if>
  134. <if test="userId !=null and userId != ''">
  135. and t.user_id= #{userId}
  136. </if>
  137. <if test="roomId !=null and roomId != ''">
  138. and t.room_id= #{roomId}
  139. </if>
  140. <if test="roomIds != null">
  141. and t.room_id in
  142. <foreach collection="roomIds" item="item" open="(" close=")" separator=",">
  143. #{item}
  144. </foreach>
  145. </if>
  146. <if test="layer !=null and layer != ''">
  147. and t.layer= #{layer}
  148. </if>
  149. <if test="builtUpArea !=null and builtUpArea != ''">
  150. and t.built_up_area= #{builtUpArea}
  151. </if>
  152. <if test="roomNum !=null and roomNum != ''">
  153. and t.room_num= #{roomNum}
  154. </if>
  155. <if test="unitId !=null and unitId != ''">
  156. and t.unit_id= #{unitId}
  157. </if>
  158. <if test="bId !=null and bId != ''">
  159. and t.b_id= #{bId}
  160. </if>
  161. <if test="apartment !=null and apartment != ''">
  162. and t.apartment= #{apartment}
  163. </if>
  164. <if test="state !=null and state != ''">
  165. and t.state= #{state}
  166. </if>
  167. <if test="communityId !=null and communityId != ''">
  168. and t.community_id= #{communityId}
  169. </if>
  170. order by t.create_time desc
  171. <if test="page != -1 and page != null">
  172. limit #{page},#{row}
  173. </if>
  174. </select>
  175. <!-- 修改小区房屋信息 add by wuxw 2018-07-03 -->
  176. <update id="updateRoomInfoInstance" parameterType="Map">
  177. update building_room t set t.status_cd = #{statusCd}
  178. <if test="newBId != null and newBId != ''">
  179. ,t.b_id = #{newBId}
  180. </if>
  181. <if test="unitPrice !=null and unitPrice != ''">
  182. , t.unit_price= #{unitPrice}
  183. </if>
  184. <if test="section !=null and section != ''">
  185. , t.section= #{section}
  186. </if>
  187. <if test="remark !=null and remark != ''">
  188. , t.remark= #{remark}
  189. </if>
  190. <if test="userId !=null and userId != ''">
  191. , t.user_id= #{userId}
  192. </if>
  193. <if test="layer !=null and layer != ''">
  194. , t.layer= #{layer}
  195. </if>
  196. <if test="builtUpArea !=null and builtUpArea != ''">
  197. , t.built_up_area= #{builtUpArea}
  198. </if>
  199. <if test="roomNum !=null and roomNum != ''">
  200. , t.room_num= #{roomNum}
  201. </if>
  202. <if test="unitId !=null and unitId != ''">
  203. , t.unit_id= #{unitId}
  204. </if>
  205. <if test="apartment !=null and apartment != ''">
  206. , t.apartment= #{apartment}
  207. </if>
  208. <if test="state !=null and state != ''">
  209. , t.state= #{state}
  210. </if>
  211. where 1=1
  212. <if test="roomId !=null and roomId != ''">
  213. and t.room_id= #{roomId}
  214. </if>
  215. <if test="communityId !=null and communityId != ''">
  216. and t.community_id= #{communityId}
  217. </if>
  218. <if test="bId !=null and bId != ''">
  219. and t.b_id= #{bId}
  220. </if>
  221. </update>
  222. <!-- 查询小区房屋数量 add by wuxw 2018-07-03 -->
  223. <select id="queryRoomsCount" parameterType="Map" resultType="Map">
  224. select count(1) count
  225. from building_room t
  226. where 1 =1
  227. <if test="unitPrice !=null and unitPrice != ''">
  228. and t.unit_price= #{unitPrice}
  229. </if>
  230. <if test="section !=null and section != ''">
  231. and t.section= #{section}
  232. </if>
  233. <if test="statusCd !=null and statusCd != ''">
  234. and t.status_cd= #{statusCd}
  235. </if>
  236. <if test="remark !=null and remark != ''">
  237. and t.remark= #{remark}
  238. </if>
  239. <if test="userId !=null and userId != ''">
  240. and t.user_id= #{userId}
  241. </if>
  242. <if test="roomId !=null and roomId != ''">
  243. and t.room_id= #{roomId}
  244. </if>
  245. <if test="layer !=null and layer != ''">
  246. and t.layer= #{layer}
  247. </if>
  248. <if test="builtUpArea !=null and builtUpArea != ''">
  249. and t.built_up_area= #{builtUpArea}
  250. </if>
  251. <if test="roomNum !=null and roomNum != ''">
  252. and t.room_num= #{roomNum}
  253. </if>
  254. <if test="unitId !=null and unitId != ''">
  255. and t.unit_id= #{unitId}
  256. </if>
  257. <if test="bId !=null and bId != ''">
  258. and t.b_id= #{bId}
  259. </if>
  260. <if test="apartment !=null and apartment != ''">
  261. and t.apartment= #{apartment}
  262. </if>
  263. <if test="state !=null and state != ''">
  264. and t.state= #{state}
  265. </if>
  266. <if test="communityId !=null and communityId != ''">
  267. and t.community_id= #{communityId}
  268. </if>
  269. </select>
  270. <!-- 查询小区房屋数量 add by wuxw 2018-07-03 -->
  271. <select id="queryRoomsByCommunityIdCount" parameterType="Map" resultType="Map">
  272. select count(1) count
  273. FROM building_room t,building_unit u,f_floor f
  274. WHERE 1 =1
  275. AND t.`unit_id` = u.`unit_id`
  276. AND u.`floor_id` = f.`floor_id`
  277. AND f.`community_id` = t.`community_id`
  278. AND u.`status_cd` = '0'
  279. AND f.`status_cd` = '0'
  280. AND t.`community_id` = #{communityId}
  281. <if test="floorId !=null and floorId != ''">
  282. and f.`floor_id`= #{floorId}
  283. </if>
  284. <if test="unitPrice !=null and unitPrice != ''">
  285. and t.unit_price= #{unitPrice}
  286. </if>
  287. <if test="section !=null and section != ''">
  288. and t.section= #{section}
  289. </if>
  290. <if test="statusCd !=null and statusCd != ''">
  291. and t.status_cd= #{statusCd}
  292. </if>
  293. <if test="remark !=null and remark != ''">
  294. and t.remark= #{remark}
  295. </if>
  296. <if test="userId !=null and userId != ''">
  297. and t.user_id= #{userId}
  298. </if>
  299. <if test="roomId !=null and roomId != ''">
  300. and t.room_id= #{roomId}
  301. </if>
  302. <if test="layer !=null and layer != ''">
  303. and t.layer= #{layer}
  304. </if>
  305. <if test="builtUpArea !=null and builtUpArea != ''">
  306. and t.built_up_area= #{builtUpArea}
  307. </if>
  308. <if test="roomNum !=null and roomNum != ''">
  309. and t.room_num= #{roomNum}
  310. </if>
  311. <if test="unitId !=null and unitId != ''">
  312. and t.unit_id= #{unitId}
  313. </if>
  314. <if test="bId !=null and bId != ''">
  315. and t.b_id= #{bId}
  316. </if>
  317. <if test="apartment !=null and apartment != ''">
  318. and t.apartment= #{apartment}
  319. </if>
  320. <if test="state !=null and state != ''">
  321. and t.state= #{state}
  322. </if>
  323. <if test="communityId !=null and communityId != ''">
  324. and t.community_id= #{communityId}
  325. </if>
  326. </select>
  327. <!-- 查询小区房屋数量 add by wuxw 2018-07-03 -->
  328. <select id="queryRoomsWithOutSellByCommunityIdCount" parameterType="Map" resultType="Map">
  329. select
  330. count(1) count
  331. FROM
  332. building_room t,
  333. building_unit u,
  334. f_floor f
  335. WHERE 1 =1
  336. AND t.`unit_id` = u.`unit_id`
  337. AND u.`floor_id` = f.`floor_id`
  338. AND f.`community_id` = t.`community_id`
  339. AND u.`status_cd` = '0'
  340. AND f.`status_cd` = '0'
  341. AND t.`community_id` = #{communityId}
  342. <if test="floorId !=null and floorId != ''">
  343. and f.`floor_id`= #{floorId}
  344. </if>
  345. <if test="unitPrice !=null and unitPrice != ''">
  346. and t.unit_price= #{unitPrice}
  347. </if>
  348. <if test="section !=null and section != ''">
  349. and t.section= #{section}
  350. </if>
  351. <if test="statusCd !=null and statusCd != ''">
  352. and t.status_cd= #{statusCd}
  353. </if>
  354. <if test="remark !=null and remark != ''">
  355. and t.remark= #{remark}
  356. </if>
  357. <if test="userId !=null and userId != ''">
  358. and t.user_id= #{userId}
  359. </if>
  360. <if test="roomId !=null and roomId != ''">
  361. and t.room_id= #{roomId}
  362. </if>
  363. <if test="layer !=null and layer != ''">
  364. and t.layer= #{layer}
  365. </if>
  366. <if test="builtUpArea !=null and builtUpArea != ''">
  367. and t.built_up_area= #{builtUpArea}
  368. </if>
  369. <if test="roomNum !=null and roomNum != ''">
  370. and t.room_num= #{roomNum}
  371. </if>
  372. <if test="unitId !=null and unitId != ''">
  373. and t.unit_id= #{unitId}
  374. </if>
  375. <if test="bId !=null and bId != ''">
  376. and t.b_id= #{bId}
  377. </if>
  378. <if test="apartment !=null and apartment != ''">
  379. and t.apartment= #{apartment}
  380. </if>
  381. <if test="state !=null and state != ''">
  382. and t.state= #{state}
  383. </if>
  384. <if test="communityId !=null and communityId != ''">
  385. and t.community_id= #{communityId}
  386. </if>
  387. AND NOT EXISTS(
  388. SELECT 1 FROM building_owner_room_rel borr
  389. WHERE borr.`status_cd` = '0'
  390. AND borr.`room_id` = t.`room_id`
  391. )
  392. </select>
  393. <!-- 查询小区房屋数量 add by wuxw 2018-07-03 -->
  394. <select id="queryRoomsWithSellByCommunityIdCount" parameterType="Map" resultType="Map">
  395. select
  396. count(1) count
  397. FROM
  398. building_room t,
  399. building_unit u,
  400. f_floor f
  401. WHERE 1 =1
  402. AND t.`unit_id` = u.`unit_id`
  403. AND u.`floor_id` = f.`floor_id`
  404. AND f.`community_id` = t.`community_id`
  405. AND u.`status_cd` = '0'
  406. AND f.`status_cd` = '0'
  407. AND t.`community_id` = #{communityId}
  408. <if test="floorId !=null and floorId != ''">
  409. and f.`floor_id`= #{floorId}
  410. </if>
  411. <if test="unitPrice !=null and unitPrice != ''">
  412. and t.unit_price= #{unitPrice}
  413. </if>
  414. <if test="section !=null and section != ''">
  415. and t.section= #{section}
  416. </if>
  417. <if test="statusCd !=null and statusCd != ''">
  418. and t.status_cd= #{statusCd}
  419. </if>
  420. <if test="remark !=null and remark != ''">
  421. and t.remark= #{remark}
  422. </if>
  423. <if test="userId !=null and userId != ''">
  424. and t.user_id= #{userId}
  425. </if>
  426. <if test="roomId !=null and roomId != ''">
  427. and t.room_id= #{roomId}
  428. </if>
  429. <if test="layer !=null and layer != ''">
  430. and t.layer= #{layer}
  431. </if>
  432. <if test="builtUpArea !=null and builtUpArea != ''">
  433. and t.built_up_area= #{builtUpArea}
  434. </if>
  435. <if test="roomNum !=null and roomNum != ''">
  436. and t.room_num= #{roomNum}
  437. </if>
  438. <if test="unitId !=null and unitId != ''">
  439. and t.unit_id= #{unitId}
  440. </if>
  441. <if test="bId !=null and bId != ''">
  442. and t.b_id= #{bId}
  443. </if>
  444. <if test="apartment !=null and apartment != ''">
  445. and t.apartment= #{apartment}
  446. </if>
  447. <if test="state !=null and state != ''">
  448. and t.state= #{state}
  449. </if>
  450. <if test="communityId !=null and communityId != ''">
  451. and t.community_id= #{communityId}
  452. </if>
  453. AND EXISTS(
  454. SELECT 1 FROM building_owner_room_rel borr
  455. WHERE borr.`status_cd` = '0'
  456. AND borr.`room_id` = t.`room_id`
  457. )
  458. </select>
  459. <!-- 查询小区房屋信息 add by wuxw 2018-07-03 -->
  460. <select id="getRoomInfoWithOutSellByCommunityId" parameterType="Map" resultType="Map">
  461. SELECT t.unit_price,t.unit_price unitPrice,t.section,t.status_cd,t.status_cd statusCd,t.remark,t.user_id,
  462. 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,
  463. 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
  464. FROM building_room t,building_unit u,f_floor f
  465. WHERE 1 =1
  466. AND t.`unit_id` = u.`unit_id`
  467. AND u.`floor_id` = f.`floor_id`
  468. AND f.`community_id` = t.`community_id`
  469. AND u.`status_cd` = '0'
  470. AND f.`status_cd` = '0'
  471. AND t.`community_id` = #{communityId}
  472. <if test="floorId !=null and floorId != ''">
  473. and f.`floor_id`= #{floorId}
  474. </if>
  475. <if test="unitPrice !=null and unitPrice != ''">
  476. and t.unit_price= #{unitPrice}
  477. </if>
  478. <if test="section !=null and section != ''">
  479. and t.section= #{section}
  480. </if>
  481. <if test="statusCd !=null and statusCd != ''">
  482. and t.status_cd= #{statusCd}
  483. </if>
  484. <if test="remark !=null and remark != ''">
  485. and t.remark= #{remark}
  486. </if>
  487. <if test="userId !=null and userId != ''">
  488. and t.user_id= #{userId}
  489. </if>
  490. <if test="roomId !=null and roomId != ''">
  491. and t.room_id= #{roomId}
  492. </if>
  493. <if test="layer !=null and layer != ''">
  494. and t.layer= #{layer}
  495. </if>
  496. <if test="builtUpArea !=null and builtUpArea != ''">
  497. and t.built_up_area= #{builtUpArea}
  498. </if>
  499. <if test="roomNum !=null and roomNum != ''">
  500. and t.room_num= #{roomNum}
  501. </if>
  502. <if test="unitId !=null and unitId != ''">
  503. and t.unit_id= #{unitId}
  504. </if>
  505. <if test="bId !=null and bId != ''">
  506. and t.b_id= #{bId}
  507. </if>
  508. <if test="apartment !=null and apartment != ''">
  509. and t.apartment= #{apartment}
  510. </if>
  511. <if test="state !=null and state != ''">
  512. and t.state= #{state}
  513. </if>
  514. <if test="communityId !=null and communityId != ''">
  515. and t.community_id= #{communityId}
  516. </if>
  517. AND NOT EXISTS(
  518. SELECT 1 FROM building_owner_room_rel borr
  519. WHERE borr.`status_cd` = '0'
  520. AND borr.`room_id` = t.`room_id`
  521. )
  522. <if test="page != -1 and page != null">
  523. limit #{page},#{row}
  524. </if>
  525. </select>
  526. <!-- 查询小区房屋信息 add by wuxw 2018-07-03 -->
  527. <select id="getRoomInfoWithSellByCommunityId" parameterType="Map" resultType="Map">
  528. SELECT t.unit_price,t.unit_price unitPrice,t.section,t.status_cd,t.status_cd statusCd,t.remark,t.user_id,
  529. 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,
  530. 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
  531. FROM building_room t,building_unit u,f_floor f
  532. WHERE 1 =1
  533. AND t.`unit_id` = u.`unit_id`
  534. AND u.`floor_id` = f.`floor_id`
  535. AND f.`community_id` = t.`community_id`
  536. AND u.`status_cd` = '0'
  537. AND f.`status_cd` = '0'
  538. AND t.`community_id` = #{communityId}
  539. <if test="floorId !=null and floorId != ''">
  540. and f.`floor_id`= #{floorId}
  541. </if>
  542. <if test="unitPrice !=null and unitPrice != ''">
  543. and t.unit_price= #{unitPrice}
  544. </if>
  545. <if test="section !=null and section != ''">
  546. and t.section= #{section}
  547. </if>
  548. <if test="statusCd !=null and statusCd != ''">
  549. and t.status_cd= #{statusCd}
  550. </if>
  551. <if test="remark !=null and remark != ''">
  552. and t.remark= #{remark}
  553. </if>
  554. <if test="userId !=null and userId != ''">
  555. and t.user_id= #{userId}
  556. </if>
  557. <if test="roomId !=null and roomId != ''">
  558. and t.room_id= #{roomId}
  559. </if>
  560. <if test="layer !=null and layer != ''">
  561. and t.layer= #{layer}
  562. </if>
  563. <if test="builtUpArea !=null and builtUpArea != ''">
  564. and t.built_up_area= #{builtUpArea}
  565. </if>
  566. <if test="roomNum !=null and roomNum != ''">
  567. and t.room_num= #{roomNum}
  568. </if>
  569. <if test="unitId !=null and unitId != ''">
  570. and t.unit_id= #{unitId}
  571. </if>
  572. <if test="bId !=null and bId != ''">
  573. and t.b_id= #{bId}
  574. </if>
  575. <if test="apartment !=null and apartment != ''">
  576. and t.apartment= #{apartment}
  577. </if>
  578. <if test="state !=null and state != ''">
  579. and t.state= #{state}
  580. </if>
  581. <if test="communityId !=null and communityId != ''">
  582. and t.community_id= #{communityId}
  583. </if>
  584. AND EXISTS(
  585. SELECT 1 FROM building_owner_room_rel borr
  586. WHERE borr.`status_cd` = '0'
  587. AND borr.`room_id` = t.`room_id`
  588. )
  589. <if test="page != -1 and page != null">
  590. limit #{page},#{row}
  591. </if>
  592. </select>
  593. <!-- 查询小区房屋信息 add by wuxw 2018-07-03 -->
  594. <select id="getRoomInfoByCommunityId" parameterType="Map" resultType="Map">
  595. SELECT t.unit_price,t.unit_price unitPrice,t.section,t.status_cd,t.status_cd statusCd,t.remark,t.user_id,
  596. 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,
  597. 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,
  598. u.unit_id unitId,f.floor_id floorId,f.floor_num floorNum
  599. FROM building_room t,building_unit u,f_floor f
  600. WHERE 1 =1
  601. AND t.`unit_id` = u.`unit_id`
  602. AND u.`floor_id` = f.`floor_id`
  603. AND f.`community_id` = t.`community_id`
  604. AND u.`status_cd` = '0'
  605. AND f.`status_cd` = '0'
  606. AND t.`community_id` = #{communityId}
  607. <if test="floorId !=null and floorId != ''">
  608. and f.`floor_id`= #{floorId}
  609. </if>
  610. <if test="unitPrice !=null and unitPrice != ''">
  611. and t.unit_price= #{unitPrice}
  612. </if>
  613. <if test="section !=null and section != ''">
  614. and t.section= #{section}
  615. </if>
  616. <if test="statusCd !=null and statusCd != ''">
  617. and t.status_cd= #{statusCd}
  618. </if>
  619. <if test="remark !=null and remark != ''">
  620. and t.remark= #{remark}
  621. </if>
  622. <if test="userId !=null and userId != ''">
  623. and t.user_id= #{userId}
  624. </if>
  625. <if test="roomId !=null and roomId != ''">
  626. and t.room_id= #{roomId}
  627. </if>
  628. <if test="roomIds != null">
  629. and t.room_id in
  630. <foreach collection="roomIds" item="item" open="(" close=")" separator=",">
  631. #{item}
  632. </foreach>
  633. </if>
  634. <if test="layer !=null and layer != ''">
  635. and t.layer= #{layer}
  636. </if>
  637. <if test="builtUpArea !=null and builtUpArea != ''">
  638. and t.built_up_area= #{builtUpArea}
  639. </if>
  640. <if test="roomNum !=null and roomNum != ''">
  641. and t.room_num= #{roomNum}
  642. </if>
  643. <if test="unitId !=null and unitId != ''">
  644. and t.unit_id= #{unitId}
  645. </if>
  646. <if test="bId !=null and bId != ''">
  647. and t.b_id= #{bId}
  648. </if>
  649. <if test="apartment !=null and apartment != ''">
  650. and t.apartment= #{apartment}
  651. </if>
  652. <if test="state !=null and state != ''">
  653. and t.state= #{state}
  654. </if>
  655. <if test="communityId !=null and communityId != ''">
  656. and t.community_id= #{communityId}
  657. </if>
  658. <if test="page != -1 and page != null">
  659. limit #{page},#{row}
  660. </if>
  661. </select>
  662. <!-- 根据业主查询房屋信息 -->
  663. <select id="getRoomInfoByOwner" parameterType="Map" resultType="Map">
  664. SELECT
  665. t.unit_price,t.unit_price unitPrice,t.section,t.status_cd,t.status_cd statusCd,t.remark,t.user_id,
  666. 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,
  667. 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`
  668. unitNum,f.`floor_num` floorNum
  669. FROM
  670. building_owner bo,building_room t,building_owner_room_rel borr,building_unit u,f_floor f
  671. WHERE
  672. bo.`owner_id` = borr.`owner_id`
  673. AND borr.`room_id` = t.`room_id`
  674. AND t.`unit_id` = u.`unit_id`
  675. AND u.`floor_id` = f.`floor_id`
  676. AND u.`status_cd` = '0'
  677. AND f.`status_cd` = '0'
  678. AND borr.`status_cd` = '0'
  679. AND t.`status_cd` = '0'
  680. AND bo.`status_cd` = '0'
  681. AND bo.`owner_type_cd` = '1001'
  682. <if test="sex !=null ">
  683. and bo.sex= #{sex}
  684. </if>
  685. <if test="name !=null and name != ''">
  686. and bo.name= #{name}
  687. </if>
  688. <if test="link !=null and link != ''">
  689. and bo.link= #{link}
  690. </if>
  691. <if test="statusCd !=null and statusCd != ''">
  692. and bo.status_cd= #{statusCd}
  693. </if>
  694. <if test="remark !=null and remark != ''">
  695. and bo.remark= #{remark}
  696. </if>
  697. <if test="ownerId !=null and ownerId != ''">
  698. and bo.owner_id= #{ownerId}
  699. </if>
  700. <if test="bId !=null and bId != ''">
  701. and bo.b_id= #{bId}
  702. </if>
  703. <if test="userId !=null and userId != ''">
  704. and bo.user_id= #{userId}
  705. </if>
  706. <if test="age !=null and age != ''">
  707. and bo.age= #{age}
  708. </if>
  709. <if test="memberId !=null and memberId != ''">
  710. and bo.member_id= #{memberId}
  711. </if>
  712. <if test="ownerTypeCd !=null and ownerTypeCd != ''">
  713. and bo.owner_type_cd= #{ownerTypeCd}
  714. </if>
  715. </select>
  716. </mapper>