RoomServiceDaoImplMapper.xml 34 KB

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