ReportFeeMonthStatisticsServiceDaoImplMapper.xml 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677
  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
  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
  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="objName !=null and objName != ''">
  327. and t.obj_name= #{objName}
  328. </if>
  329. <if test="feeYear !=null and feeYear != ''">
  330. and t.fee_year= #{feeYear}
  331. </if>
  332. <if test="feeMonth !=null and feeMonth != ''">
  333. and t.fee_month= #{feeMonth}
  334. </if>
  335. <if test="feeId !=null and feeId != ''">
  336. and t.fee_id= #{feeId}
  337. </if>
  338. <if test="configId !=null and configId != ''">
  339. and t.config_id= #{configId}
  340. </if>
  341. <if test="objId !=null and objId != ''">
  342. and t.obj_id= #{objId}
  343. </if>
  344. <if test="feeName !=null and feeName != ''">
  345. and t.fee_name= #{feeName}
  346. </if>
  347. <if test="communityId !=null and communityId != ''">
  348. and t.community_id= #{communityId}
  349. </if>
  350. <if test="startTime !=null">
  351. and t.create_time &gt;= #{startTime}
  352. </if>
  353. <if test="endTime !=null">
  354. and t.create_time &lt;= #{endTime}
  355. </if>
  356. GROUP BY t.fee_year,t.fee_month,f.floor_num,bu.unit_id,bu.unit_num
  357. ) t
  358. </select>
  359. <!-- 查询费用月统计信息 add by wuxw 2018-07-03 -->
  360. <select id="queryReportFloorUnitFeeSummary" parameterType="Map" resultType="Map">
  361. select t.fee_year feeYear,t.fee_month feeMonth, f.floor_num floorNum, bu.unit_num unitNum,
  362. SUM(t.receivable_amount) receivableAmount,SUM(t.received_amount) receivedAmount,SUM(t.owe_amount) oweAmount
  363. from report_fee_month_statistics t
  364. INNER JOIN building_room br on t.obj_id = br.room_id and br.status_cd = '0'
  365. inner join building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0'
  366. inner join f_floor f on bu.floor_id = f.floor_id and f.status_cd = '0'
  367. where t.status_cd = '0'
  368. <if test="objName !=null and objName != ''">
  369. and t.obj_name= #{objName}
  370. </if>
  371. <if test="feeYear !=null and feeYear != ''">
  372. and t.fee_year= #{feeYear}
  373. </if>
  374. <if test="feeMonth !=null and feeMonth != ''">
  375. and t.fee_month= #{feeMonth}
  376. </if>
  377. <if test="feeId !=null and feeId != ''">
  378. and t.fee_id= #{feeId}
  379. </if>
  380. <if test="configId !=null and configId != ''">
  381. and t.config_id= #{configId}
  382. </if>
  383. <if test="objId !=null and objId != ''">
  384. and t.obj_id= #{objId}
  385. </if>
  386. <if test="feeName !=null and feeName != ''">
  387. and t.fee_name= #{feeName}
  388. </if>
  389. <if test="communityId !=null and communityId != ''">
  390. and t.community_id= #{communityId}
  391. </if>
  392. <if test="startTime !=null">
  393. and t.create_time &gt;= #{startTime}
  394. </if>
  395. <if test="endTime !=null">
  396. and t.create_time &lt;= #{endTime}
  397. </if>
  398. GROUP BY t.fee_year,t.fee_month,f.floor_num,bu.unit_id,bu.unit_num
  399. <if test="page != -1 and page != null ">
  400. limit #{page}, #{row}
  401. </if>
  402. </select>
  403. <select id="queryFeeBreakdownCount" parameterType="Map" resultType="Map">
  404. select count(1) count
  405. from (
  406. select t.fee_name,pfc.start_time
  407. from report_fee_month_statistics t
  408. inner join pay_fee_config pfc on t.config_id = pfc.config_id and pfc.status_cd = '0'
  409. where t.status_cd = '0'
  410. <if test="objName !=null and objName != ''">
  411. and t.obj_name= #{objName}
  412. </if>
  413. <if test="feeYear !=null and feeYear != ''">
  414. and t.fee_year= #{feeYear}
  415. </if>
  416. <if test="feeMonth !=null and feeMonth != ''">
  417. and t.fee_month= #{feeMonth}
  418. </if>
  419. <if test="feeId !=null and feeId != ''">
  420. and t.fee_id= #{feeId}
  421. </if>
  422. <if test="configId !=null and configId != ''">
  423. and t.config_id= #{configId}
  424. </if>
  425. <if test="objId !=null and objId != ''">
  426. and t.obj_id= #{objId}
  427. </if>
  428. <if test="feeName !=null and feeName != ''">
  429. and t.fee_name= #{feeName}
  430. </if>
  431. <if test="communityId !=null and communityId != ''">
  432. and t.community_id= #{communityId}
  433. </if>
  434. <if test="startTime !=null">
  435. and t.create_time &gt;= #{startTime}
  436. </if>
  437. <if test="endTime !=null">
  438. and t.create_time &lt;= #{endTime}
  439. </if>
  440. group by t.config_id,t.fee_name,pfc.start_time
  441. ) t
  442. </select>
  443. <!-- 查询费用月统计信息 add by wuxw 2018-07-03 -->
  444. <select id="queryFeeBreakdown" parameterType="Map" resultType="Map">
  445. select t.fee_name feeName,pfc.start_time feeCreateTime,SUM(t.receivable_amount)
  446. receivableAmount,SUM(t.received_amount) receivedAmount,SUM(t.owe_amount) oweAmount
  447. from report_fee_month_statistics t
  448. inner join pay_fee_config pfc on t.config_id = pfc.config_id and pfc.status_cd = '0'
  449. where t.status_cd = '0'
  450. <if test="objName !=null and objName != ''">
  451. and t.obj_name= #{objName}
  452. </if>
  453. <if test="feeYear !=null and feeYear != ''">
  454. and t.fee_year= #{feeYear}
  455. </if>
  456. <if test="feeMonth !=null and feeMonth != ''">
  457. and t.fee_month= #{feeMonth}
  458. </if>
  459. <if test="feeId !=null and feeId != ''">
  460. and t.fee_id= #{feeId}
  461. </if>
  462. <if test="configId !=null and configId != ''">
  463. and t.config_id= #{configId}
  464. </if>
  465. <if test="objId !=null and objId != ''">
  466. and t.obj_id= #{objId}
  467. </if>
  468. <if test="feeName !=null and feeName != ''">
  469. and t.fee_name= #{feeName}
  470. </if>
  471. <if test="communityId !=null and communityId != ''">
  472. and t.community_id= #{communityId}
  473. </if>
  474. <if test="startTime !=null">
  475. and t.create_time &gt;= #{startTime}
  476. </if>
  477. <if test="endTime !=null">
  478. and t.create_time &lt;= #{endTime}
  479. </if>
  480. group by t.config_id,t.fee_name,pfc.start_time
  481. <if test="page != -1 and page != null ">
  482. limit #{page}, #{row}
  483. </if>
  484. </select>
  485. <select id="queryFeeDetailCount" parameterType="Map" resultType="Map">
  486. select count(1) count
  487. from (
  488. select t.obj_name objName,t.fee_name feeName,pfc.start_time
  489. from report_fee_month_statistics t
  490. inner join pay_fee_config pfc on t.config_id = pfc.config_id and pfc.status_cd = '0'
  491. where t.status_cd = '0'
  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,t.obj_id,t.obj_name
  523. ) t
  524. </select>
  525. <!-- 查询费用月统计信息 add by wuxw 2018-07-03 -->
  526. <select id="queryFeeDetail" parameterType="Map" resultType="Map">
  527. select t.obj_name objName,t.fee_name feeName,pfc.start_time feeCreateTime,SUM(t.receivable_amount)
  528. receivableAmount,SUM(t.received_amount) receivedAmount,SUM(t.owe_amount) oweAmount
  529. from report_fee_month_statistics t
  530. inner join pay_fee_config pfc on t.config_id = pfc.config_id and pfc.status_cd = '0'
  531. where t.status_cd = '0'
  532. <if test="objName !=null and objName != ''">
  533. and t.obj_name= #{objName}
  534. </if>
  535. <if test="feeYear !=null and feeYear != ''">
  536. and t.fee_year= #{feeYear}
  537. </if>
  538. <if test="feeMonth !=null and feeMonth != ''">
  539. and t.fee_month= #{feeMonth}
  540. </if>
  541. <if test="feeId !=null and feeId != ''">
  542. and t.fee_id= #{feeId}
  543. </if>
  544. <if test="configId !=null and configId != ''">
  545. and t.config_id= #{configId}
  546. </if>
  547. <if test="objId !=null and objId != ''">
  548. and t.obj_id= #{objId}
  549. </if>
  550. <if test="feeName !=null and feeName != ''">
  551. and t.fee_name= #{feeName}
  552. </if>
  553. <if test="communityId !=null and communityId != ''">
  554. and t.community_id= #{communityId}
  555. </if>
  556. <if test="startTime !=null">
  557. and t.create_time &gt;= #{startTime}
  558. </if>
  559. <if test="endTime !=null">
  560. and t.create_time &lt;= #{endTime}
  561. </if>
  562. group by t.config_id,t.fee_name,pfc.start_time,t.obj_id,t.obj_name
  563. <if test="page != -1 and page != null ">
  564. limit #{page}, #{row}
  565. </if>
  566. </select>
  567. <select id="queryOweFeeDetailCount" parameterType="Map" resultType="Map">
  568. select count(1) count
  569. from (
  570. select t.obj_name objName,t.fee_name feeName,pfc.start_time,SUM(t.owe_amount) oweAmount
  571. from report_fee_month_statistics t
  572. inner join pay_fee_config pfc on t.config_id = pfc.config_id and pfc.status_cd = '0'
  573. where t.status_cd = '0'
  574. <if test="objName !=null and objName != ''">
  575. and t.obj_name= #{objName}
  576. </if>
  577. <if test="feeYear !=null and feeYear != ''">
  578. and t.fee_year= #{feeYear}
  579. </if>
  580. <if test="feeMonth !=null and feeMonth != ''">
  581. and t.fee_month= #{feeMonth}
  582. </if>
  583. <if test="feeId !=null and feeId != ''">
  584. and t.fee_id= #{feeId}
  585. </if>
  586. <if test="configId !=null and configId != ''">
  587. and t.config_id= #{configId}
  588. </if>
  589. <if test="objId !=null and objId != ''">
  590. and t.obj_id= #{objId}
  591. </if>
  592. <if test="feeName !=null and feeName != ''">
  593. and t.fee_name= #{feeName}
  594. </if>
  595. <if test="communityId !=null and communityId != ''">
  596. and t.community_id= #{communityId}
  597. </if>
  598. <if test="startTime !=null">
  599. and t.create_time &gt;= #{startTime}
  600. </if>
  601. <if test="endTime !=null">
  602. and t.create_time &lt;= #{endTime}
  603. </if>
  604. group by t.config_id,t.fee_name,pfc.start_time,t.obj_id,t.obj_name
  605. HAVING oweAmount > 0
  606. ) t
  607. </select>
  608. <!-- 查询费用月统计信息 add by wuxw 2018-07-03 -->
  609. <select id="queryOweFeeDetail" parameterType="Map" resultType="Map">
  610. select t.obj_name objName,t.fee_name feeName,pfc.start_time feeCreateTime,SUM(t.receivable_amount)
  611. receivableAmount,SUM(t.received_amount) receivedAmount,SUM(t.owe_amount) oweAmount
  612. from report_fee_month_statistics t
  613. inner join pay_fee_config pfc on t.config_id = pfc.config_id and pfc.status_cd = '0'
  614. where t.status_cd = '0'
  615. <if test="objName !=null and objName != ''">
  616. and t.obj_name= #{objName}
  617. </if>
  618. <if test="feeYear !=null and feeYear != ''">
  619. and t.fee_year= #{feeYear}
  620. </if>
  621. <if test="feeMonth !=null and feeMonth != ''">
  622. and t.fee_month= #{feeMonth}
  623. </if>
  624. <if test="feeId !=null and feeId != ''">
  625. and t.fee_id= #{feeId}
  626. </if>
  627. <if test="configId !=null and configId != ''">
  628. and t.config_id= #{configId}
  629. </if>
  630. <if test="objId !=null and objId != ''">
  631. and t.obj_id= #{objId}
  632. </if>
  633. <if test="feeName !=null and feeName != ''">
  634. and t.fee_name= #{feeName}
  635. </if>
  636. <if test="communityId !=null and communityId != ''">
  637. and t.community_id= #{communityId}
  638. </if>
  639. <if test="startTime !=null">
  640. and t.create_time &gt;= #{startTime}
  641. </if>
  642. <if test="endTime !=null">
  643. and t.create_time &lt;= #{endTime}
  644. </if>
  645. group by t.config_id,t.fee_name,pfc.start_time,t.obj_id,t.obj_name
  646. HAVING oweAmount > 0
  647. <if test="page != -1 and page != null ">
  648. limit #{page}, #{row}
  649. </if>
  650. </select>
  651. </mapper>