BaseDataStatisticsServiceDaoImplMapper.xml 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346
  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="baseDataStatisticsServiceDaoImpl">
  6. <!-- 查询房屋数 -->
  7. <select id="getRoomCount" parameterType="Map" resultType="Map">
  8. select count(1) count
  9. from building_room t
  10. inner join building_unit bu on t.unit_id = bu.unit_id and bu.status_cd = '0'
  11. inner join f_floor f on bu.floor_id = f.floor_id and f.status_cd = '0'
  12. <if test="ownerId != null and ownerId != ''">
  13. inner join building_owner_room_rel borr on t.room_id = borr.room_id and borr.status_cd = '0'
  14. left join building_owner bo on borr.owner_id = bo.member_id and bo.status_cd = '0'
  15. </if>
  16. where 1=1
  17. and t.status_cd = '0'
  18. <if test="floorId != null and floorId != ''">
  19. and f.floor_id = #{floorId}
  20. </if>
  21. <if test="floorNum != null and floorNum != ''">
  22. and f.floor_num = #{floorNum}
  23. </if>
  24. <if test="unitNum != null and unitNum != ''">
  25. and bu.unit_num = #{unitNum}
  26. </if>
  27. <if test="roomNum != null and roomNum != ''">
  28. and t.room_num = #{roomNum}
  29. </if>
  30. <if test="roomNumLike !=null and roomNumLike != ''">
  31. and t.room_num like concat('%',#{roomNumLike},'%')
  32. </if>
  33. <if test="state !=null and state != ''">
  34. and t.state= #{state}
  35. </if>
  36. <if test="roomId != null and roomId != ''">
  37. and t.room_id = #{roomId}
  38. </if>
  39. <if test="communityId != null and communityId != ''">
  40. and t.community_id = #{communityId}
  41. </if>
  42. <if test="ownerId != null and ownerId != ''">
  43. and bo.owner_id = #{ownerId}
  44. </if>
  45. <if test="ownerName != null and ownerName != ''">
  46. and bo.`name` like concat('%',#{ownerName},'%')
  47. </if>
  48. <if test="link != null and link != ''">
  49. and bo.link = #{link}
  50. </if>
  51. </select>
  52. <!-- 查询单月欠费 -->
  53. <select id="getRoomInfo" parameterType="Map" resultType="Map">
  54. select t.fee_coefficient feeCoefficient,t.section,t.remark,t.user_id userId,
  55. t.room_id roomId,t.layer,t.built_up_area,t.built_up_area
  56. builtUpArea,t.room_num,t.room_num roomNum,t.unit_id,t.unit_id unitId,t.b_id,t.b_id
  57. bId,t.apartment,t.state,t.community_id,t.community_id communityId,t.room_type,t.room_type roomType,
  58. t.room_sub_type,t.room_rent,t.room_area,t.room_sub_type roomSubType,t.room_rent roomRent,t.room_area roomArea,
  59. f.floor_num floorNum,bu.unit_num unitNum,bo.name ownerName,bo.owner_id ownerId,bo.link
  60. from building_room t
  61. inner join building_unit bu on t.unit_id = bu.unit_id and bu.status_cd = '0'
  62. inner join f_floor f on bu.floor_id = f.floor_id and f.status_cd = '0'
  63. inner join building_owner_room_rel borr on t.room_id = borr.room_id and borr.status_cd = '0'
  64. left join building_owner bo on borr.owner_id = bo.member_id and bo.status_cd = '0'
  65. where 1=1
  66. <if test="floorId != null and floorId != ''">
  67. and f.floor_id = #{floorId}
  68. </if>
  69. <if test="floorNum != null and floorNum != ''">
  70. and f.floor_num = #{floorNum}
  71. </if>
  72. <if test="unitNum != null and unitNum != ''">
  73. and bu.unit_num = #{unitNum}
  74. </if>
  75. <if test="roomNum != null and roomNum != ''">
  76. and t.room_num = #{roomNum}
  77. </if>
  78. <if test="roomNumLike !=null and roomNumLike != ''">
  79. and t.room_num like concat('%',#{roomNumLike},'%')
  80. </if>
  81. <if test="state !=null and state != ''">
  82. and t.state= #{state}
  83. </if>
  84. <if test="roomId != null and roomId != ''">
  85. and t.room_id = #{roomId}
  86. </if>
  87. <if test="communityId != null and communityId != ''">
  88. and t.community_id = #{communityId}
  89. </if>
  90. <if test="ownerId != null and ownerId != ''">
  91. and bo.owner_id = #{ownerId}
  92. </if>
  93. <if test="ownerName != null and ownerName != ''">
  94. and bo.`name` like concat('%',#{ownerName},'%')
  95. </if>
  96. <if test="link != null and link != ''">
  97. and bo.link = #{link}
  98. </if>
  99. order by t.create_time desc
  100. <if test="page != -1 and page != null">
  101. limit #{page},#{row}
  102. </if>
  103. </select>
  104. <select id="getReceivedRoomCount" parameterType="Map" resultType="Map">
  105. select count(1) count
  106. from
  107. (select t.room_id
  108. from building_room t
  109. inner join building_unit bu on t.unit_id = bu.unit_id and bu.status_cd = '0'
  110. inner join f_floor f on bu.floor_id = f.floor_id and f.status_cd = '0'
  111. <if test="ownerId != null and ownerId != ''">
  112. inner join building_owner_room_rel borr on t.room_id = borr.room_id and borr.status_cd = '0'
  113. left join building_owner bo on borr.owner_id = bo.member_id and bo.status_cd = '0'
  114. </if>
  115. inner join pay_fee pf on t.room_id = pf.payer_obj_id and pf.payer_obj_type = '3333' and pf.status_cd = '0'
  116. inner join pay_fee_detail pfd on pf.fee_id = pfd.fee_id and pfd.status_cd = '0'
  117. where 1=1
  118. <if test="startDate != null and startDate != ''">
  119. and pfd.create_time &gt;= #{startDate}
  120. and pfd.create_time &lt;= #{endDate}
  121. </if>
  122. and t.status_cd = '0'
  123. <if test="floorId != null and floorId != ''">
  124. and f.floor_id = #{floorId}
  125. </if>
  126. <if test="floorNum != null and floorNum != ''">
  127. and f.floor_num = #{floorNum}
  128. </if>
  129. <if test="unitNum != null and unitNum != ''">
  130. and bu.unit_num = #{unitNum}
  131. </if>
  132. <if test="roomNum != null and roomNum != ''">
  133. and t.room_num = #{roomNum}
  134. </if>
  135. <if test="roomNumLike !=null and roomNumLike != ''">
  136. and t.room_num like concat('%',#{roomNumLike},'%')
  137. </if>
  138. <if test="state !=null and state != ''">
  139. and t.state= #{state}
  140. </if>
  141. <if test="roomId != null and roomId != ''">
  142. and t.room_id = #{roomId}
  143. </if>
  144. <if test="communityId != null and communityId != ''">
  145. and t.community_id = #{communityId}
  146. </if>
  147. <if test="ownerId != null and ownerId != ''">
  148. and bo.owner_id = #{ownerId}
  149. </if>
  150. <if test="ownerName != null and ownerName != ''">
  151. and bo.`name` like concat('%',#{ownerName},'%')
  152. </if>
  153. <if test="link != null and link != ''">
  154. and bo.link = #{link}
  155. </if>
  156. group by t.room_id
  157. ) a
  158. </select>
  159. <!-- 查询单月欠费 -->
  160. <select id="getReceivedRoomInfo" parameterType="Map" resultType="Map">
  161. select a.* from (
  162. select t.fee_coefficient feeCoefficient,t.section,t.remark,t.user_id userId,
  163. t.room_id roomId,t.layer,t.built_up_area,t.built_up_area
  164. builtUpArea,t.room_num,t.room_num roomNum,t.unit_id,t.unit_id unitId,t.b_id,t.b_id
  165. bId,t.apartment,t.state,t.community_id,t.community_id communityId,t.room_type,t.room_type roomType,
  166. t.room_sub_type,t.room_rent,t.room_area,t.room_sub_type roomSubType,t.room_rent roomRent,t.room_area roomArea,
  167. f.floor_num floorNum,bu.unit_num unitNum,bo.name ownerName,bo.owner_id ownerId,bo.link
  168. from building_room t
  169. inner join building_unit bu on t.unit_id = bu.unit_id and bu.status_cd = '0'
  170. inner join f_floor f on bu.floor_id = f.floor_id and f.status_cd = '0'
  171. inner join building_owner_room_rel borr on t.room_id = borr.room_id and borr.status_cd = '0'
  172. left join building_owner bo on borr.owner_id = bo.member_id and bo.status_cd = '0'
  173. inner join pay_fee pf on t.room_id = pf.payer_obj_id and pf.payer_obj_type = '3333' and pf.status_cd = '0'
  174. inner join pay_fee_detail pfd on pf.fee_id = pfd.fee_id and pfd.status_cd = '0'
  175. where 1=1
  176. <if test="startDate != null and startDate != ''">
  177. and pfd.create_time &gt;= #{startDate}
  178. and pfd.create_time &lt;= #{endDate}
  179. </if>
  180. <if test="floorId != null and floorId != ''">
  181. and f.floor_id = #{floorId}
  182. </if>
  183. <if test="floorNum != null and floorNum != ''">
  184. and f.floor_num = #{floorNum}
  185. </if>
  186. <if test="unitNum != null and unitNum != ''">
  187. and bu.unit_num = #{unitNum}
  188. </if>
  189. <if test="roomNum != null and roomNum != ''">
  190. and t.room_num = #{roomNum}
  191. </if>
  192. <if test="roomNumLike !=null and roomNumLike != ''">
  193. and t.room_num like concat('%',#{roomNumLike},'%')
  194. </if>
  195. <if test="state !=null and state != ''">
  196. and t.state= #{state}
  197. </if>
  198. <if test="roomId != null and roomId != ''">
  199. and t.room_id = #{roomId}
  200. </if>
  201. <if test="communityId != null and communityId != ''">
  202. and t.community_id = #{communityId}
  203. </if>
  204. <if test="ownerId != null and ownerId != ''">
  205. and bo.owner_id = #{ownerId}
  206. </if>
  207. <if test="ownerName != null and ownerName != ''">
  208. and bo.`name` like concat('%',#{ownerName},'%')
  209. </if>
  210. <if test="link != null and link != ''">
  211. and bo.link = #{link}
  212. </if>
  213. group by t.fee_coefficient ,t.section,t.remark,t.user_id ,
  214. 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,t.room_type,
  215. t.room_sub_type,t.room_rent,t.room_area,t.room_rent,t.room_area,
  216. f.floor_num ,bu.unit_num ,bo.name ,bo.owner_id ,bo.link
  217. order by t.create_time desc
  218. ) a
  219. <if test="page != -1 and page != null">
  220. limit #{page},#{row}
  221. </if>
  222. </select>
  223. <select id="getOweRoomCount" parameterType="Map" resultType="Map">
  224. select count(1) count
  225. from
  226. (select t.room_id
  227. from building_room t
  228. inner join building_unit bu on t.unit_id = bu.unit_id and bu.status_cd = '0'
  229. inner join f_floor f on bu.floor_id = f.floor_id and f.status_cd = '0'
  230. <if test="ownerId != null and ownerId != ''">
  231. inner join building_owner_room_rel borr on t.room_id = borr.room_id and borr.status_cd = '0'
  232. left join building_owner bo on borr.owner_id = bo.member_id and bo.status_cd = '0'
  233. </if>
  234. inner join report_owe_fee rof on t.room_id = rof.payer_obj_id and rof.payer_obj_type = '3333'
  235. where 1=1
  236. and rof.amount_owed > 0
  237. and t.status_cd = '0'
  238. <if test="floorId != null and floorId != ''">
  239. and f.floor_id = #{floorId}
  240. </if>
  241. <if test="floorNum != null and floorNum != ''">
  242. and f.floor_num = #{floorNum}
  243. </if>
  244. <if test="unitNum != null and unitNum != ''">
  245. and bu.unit_num = #{unitNum}
  246. </if>
  247. <if test="roomNum != null and roomNum != ''">
  248. and t.room_num = #{roomNum}
  249. </if>
  250. <if test="roomNumLike !=null and roomNumLike != ''">
  251. and t.room_num like concat('%',#{roomNumLike},'%')
  252. </if>
  253. <if test="state !=null and state != ''">
  254. and t.state= #{state}
  255. </if>
  256. <if test="roomId != null and roomId != ''">
  257. and t.room_id = #{roomId}
  258. </if>
  259. <if test="communityId != null and communityId != ''">
  260. and t.community_id = #{communityId}
  261. </if>
  262. <if test="ownerId != null and ownerId != ''">
  263. and bo.owner_id = #{ownerId}
  264. </if>
  265. <if test="ownerName != null and ownerName != ''">
  266. and bo.`name` like concat('%',#{ownerName},'%')
  267. </if>
  268. <if test="link != null and link != ''">
  269. and bo.link = #{link}
  270. </if>
  271. group by t.room_id
  272. ) a
  273. </select>
  274. <!-- 查询单月欠费 -->
  275. <select id="getOweRoomInfo" parameterType="Map" resultType="Map">
  276. select a.* from (
  277. select t.fee_coefficient feeCoefficient,t.section,t.remark,t.user_id userId,
  278. t.room_id roomId,t.layer,t.built_up_area,t.built_up_area
  279. builtUpArea,t.room_num,t.room_num roomNum,t.unit_id,t.unit_id unitId,t.b_id,t.b_id
  280. bId,t.apartment,t.state,t.community_id,t.community_id communityId,t.room_type,t.room_type roomType,
  281. t.room_sub_type,t.room_rent,t.room_area,t.room_sub_type roomSubType,t.room_rent roomRent,t.room_area roomArea,
  282. f.floor_num floorNum,bu.unit_num unitNum,bo.name ownerName,bo.owner_id ownerId,bo.link
  283. from building_room t
  284. inner join building_unit bu on t.unit_id = bu.unit_id and bu.status_cd = '0'
  285. inner join f_floor f on bu.floor_id = f.floor_id and f.status_cd = '0'
  286. inner join building_owner_room_rel borr on t.room_id = borr.room_id and borr.status_cd = '0'
  287. left join building_owner bo on borr.owner_id = bo.member_id and bo.status_cd = '0'
  288. inner join report_owe_fee rof on t.room_id = rof.payer_obj_id and rof.payer_obj_type = '3333'
  289. where 1=1
  290. and rof.amount_owed > 0
  291. <if test="floorId != null and floorId != ''">
  292. and f.floor_id = #{floorId}
  293. </if>
  294. <if test="floorNum != null and floorNum != ''">
  295. and f.floor_num = #{floorNum}
  296. </if>
  297. <if test="unitNum != null and unitNum != ''">
  298. and bu.unit_num = #{unitNum}
  299. </if>
  300. <if test="roomNum != null and roomNum != ''">
  301. and t.room_num = #{roomNum}
  302. </if>
  303. <if test="roomNumLike !=null and roomNumLike != ''">
  304. and t.room_num like concat('%',#{roomNumLike},'%')
  305. </if>
  306. <if test="state !=null and state != ''">
  307. and t.state= #{state}
  308. </if>
  309. <if test="roomId != null and roomId != ''">
  310. and t.room_id = #{roomId}
  311. </if>
  312. <if test="communityId != null and communityId != ''">
  313. and t.community_id = #{communityId}
  314. </if>
  315. <if test="ownerId != null and ownerId != ''">
  316. and bo.owner_id = #{ownerId}
  317. </if>
  318. <if test="ownerName != null and ownerName != ''">
  319. and bo.`name` like concat('%',#{ownerName},'%')
  320. </if>
  321. <if test="link != null and link != ''">
  322. and bo.link = #{link}
  323. </if>
  324. group by t.fee_coefficient ,t.section,t.remark,t.user_id ,
  325. 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,t.room_type,
  326. t.room_sub_type,t.room_rent,t.room_area,t.room_rent,t.room_area,
  327. f.floor_num ,bu.unit_num ,bo.name ,bo.owner_id ,bo.link
  328. order by t.create_time desc
  329. ) a
  330. <if test="page != -1 and page != null">
  331. limit #{page},#{row}
  332. </if>
  333. </select>
  334. </mapper>