ReportFeeMonthStatisticsServiceDaoImplMapper.xml 33 KB

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