RoomServiceDaoImplMapper.xml 35 KB

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