RoomServiceDaoImplMapper.xml 32 KB

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