ReportFeeMonthStatisticsServiceDaoImplMapper.xml 53 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305
  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,
  10. obj_id,fee_name,owe_amount,community_id,fee_create_time,obj_type,deadline_time
  11. ) values (
  12. #{receivableAmount},#{statisticsId},#{updateTime},#{remark},#{objName},#{receivedAmount},#{feeYear},#{feeMonth},
  13. #{feeId},#{configId},#{objId},#{feeName},#{oweAmount},#{communityId},#{feeCreateTime},#{objType},#{deadlineTime}
  14. )
  15. </insert>
  16. <!-- 查询费用月统计信息 add by wuxw 2018-07-03 -->
  17. <select id="getReportFeeMonthStatisticsInfo" parameterType="Map" resultType="Map">
  18. select t.receivable_amount,t.receivable_amount receivableAmount,t.statistics_id,t.statistics_id
  19. statisticsId,t.update_time,t.update_time updateTime,t.remark,t.status_cd,t.status_cd
  20. statusCd,t.obj_name,t.obj_name objName,t.received_amount,t.received_amount receivedAmount,t.fee_year,t.fee_year
  21. feeYear,t.fee_month,t.fee_month feeMonth,t.fee_id,t.fee_id feeId,t.config_id,t.config_id
  22. configId,t.obj_id,t.obj_id objId,t.fee_name,t.fee_name feeName,t.owe_amount,t.owe_amount
  23. oweAmount,t.community_id,t.community_id communityId,t.fee_create_time,t.fee_create_time
  24. feeCreateTime,t.obj_type,t.obj_type objType
  25. from report_fee_month_statistics t
  26. where 1 =1
  27. <if test="receivableAmount !=null and receivableAmount != ''">
  28. and t.receivable_amount= #{receivableAmount}
  29. </if>
  30. <if test="statisticsId !=null and statisticsId != ''">
  31. and t.statistics_id= #{statisticsId}
  32. </if>
  33. <if test="updateTime !=null and updateTime != ''">
  34. and t.update_time= #{updateTime}
  35. </if>
  36. <if test="remark !=null and remark != ''">
  37. and t.remark= #{remark}
  38. </if>
  39. <if test="statusCd !=null and statusCd != ''">
  40. and t.status_cd= #{statusCd}
  41. </if>
  42. <if test="objName !=null and objName != ''">
  43. and t.obj_name= #{objName}
  44. </if>
  45. <if test="receivedAmount !=null and receivedAmount != ''">
  46. and t.received_amount= #{receivedAmount}
  47. </if>
  48. <if test="feeYear !=null and feeYear != ''">
  49. and t.fee_year= #{feeYear}
  50. </if>
  51. <if test="feeMonth !=null and feeMonth != ''">
  52. and t.fee_month= #{feeMonth}
  53. </if>
  54. <if test="feeId !=null and feeId != ''">
  55. and t.fee_id= #{feeId}
  56. </if>
  57. <if test="configId !=null and configId != ''">
  58. and t.config_id= #{configId}
  59. </if>
  60. <if test="objId !=null and objId != ''">
  61. and t.obj_id= #{objId}
  62. </if>
  63. <if test="feeName !=null and feeName != ''">
  64. and t.fee_name= #{feeName}
  65. </if>
  66. <if test="oweAmount !=null and oweAmount != ''">
  67. and t.owe_amount= #{oweAmount}
  68. </if>
  69. <if test="communityId !=null and communityId != ''">
  70. and t.community_id= #{communityId}
  71. </if>
  72. <if test="feeCreateTime !=null and feeCreateTime != ''">
  73. and t.fee_create_time= #{feeCreateTime}
  74. </if>
  75. <if test="objType !=null and objType != ''">
  76. and t.obj_type= #{objType}
  77. </if>
  78. order by t.create_time desc
  79. <if test="page != -1 and page != null ">
  80. limit #{page}, #{row}
  81. </if>
  82. </select>
  83. <!-- 修改费用月统计信息 add by wuxw 2018-07-03 -->
  84. <update id="updateReportFeeMonthStatisticsOwe" parameterType="Map">
  85. update report_fee_month_statistics t set
  86. t.owe_amount= #{oweAmount}
  87. where 1=1
  88. <if test="statisticsId !=null and statisticsId != ''">
  89. and t.statistics_id= #{statisticsId}
  90. </if>
  91. <if test="feeYear !=null ">
  92. and t.fee_year &lt;= #{feeYear}
  93. </if>
  94. <if test="feeMonth !=null ">
  95. and t.fee_month &lt;= #{feeMonth}
  96. </if>
  97. <if test="feeId !=null and feeId != ''">
  98. and t.fee_id= #{feeId}
  99. </if>
  100. </update>
  101. <!-- 修改费用月统计信息 add by wuxw 2018-07-03 -->
  102. <update id="updateReportFeeMonthStatisticsInfo" parameterType="Map">
  103. update report_fee_month_statistics t set t.status_cd = #{statusCd}
  104. <if test="newBId != null and newBId != ''">
  105. ,t.b_id = #{newBId}
  106. </if>
  107. <if test="receivableAmount !=null and receivableAmount != ''">
  108. , t.receivable_amount= #{receivableAmount}
  109. </if>
  110. <if test="updateTime !=null and updateTime != ''">
  111. , t.update_time= #{updateTime}
  112. </if>
  113. <if test="deadlineTime !=null ">
  114. , t.deadline_time= #{deadlineTime}
  115. </if>
  116. <if test="remark !=null and remark != ''">
  117. , t.remark= #{remark}
  118. </if>
  119. <if test="objName !=null and objName != ''">
  120. , t.obj_name= #{objName}
  121. </if>
  122. <if test="receivedAmount !=null and receivedAmount != ''">
  123. , t.received_amount= #{receivedAmount}
  124. </if>
  125. <if test="feeYear !=null and feeYear != ''">
  126. , t.fee_year= #{feeYear}
  127. </if>
  128. <if test="feeMonth !=null and feeMonth != ''">
  129. , t.fee_month= #{feeMonth}
  130. </if>
  131. <if test="feeId !=null and feeId != ''">
  132. , t.fee_id= #{feeId}
  133. </if>
  134. <if test="configId !=null and configId != ''">
  135. , t.config_id= #{configId}
  136. </if>
  137. <if test="objId !=null and objId != ''">
  138. , t.obj_id= #{objId}
  139. </if>
  140. <if test="feeName !=null and feeName != ''">
  141. , t.fee_name= #{feeName}
  142. </if>
  143. <if test="oweAmount !=null and oweAmount != ''">
  144. , t.owe_amount= #{oweAmount}
  145. </if>
  146. <if test="communityId !=null and communityId != ''">
  147. , t.community_id= #{communityId}
  148. </if>
  149. <if test="feeCreateTime !=null and feeCreateTime != ''">
  150. , t.fee_create_time= #{feeCreateTime}
  151. </if>
  152. <if test="objType !=null and objType != ''">
  153. , t.obj_type= #{objType}
  154. </if>
  155. where 1=1
  156. <if test="statisticsId !=null and statisticsId != ''">
  157. and t.statistics_id= #{statisticsId}
  158. </if>
  159. </update>
  160. <!-- 查询费用月统计数量 add by wuxw 2018-07-03 -->
  161. <select id="queryReportFeeMonthStatisticssCount" parameterType="Map" resultType="Map">
  162. select count(1) count
  163. from report_fee_month_statistics t
  164. where 1 =1
  165. <if test="receivableAmount !=null and receivableAmount != ''">
  166. and t.receivable_amount= #{receivableAmount}
  167. </if>
  168. <if test="statisticsId !=null and statisticsId != ''">
  169. and t.statistics_id= #{statisticsId}
  170. </if>
  171. <if test="updateTime !=null and updateTime != ''">
  172. and t.update_time= #{updateTime}
  173. </if>
  174. <if test="remark !=null and remark != ''">
  175. and t.remark= #{remark}
  176. </if>
  177. <if test="statusCd !=null and statusCd != ''">
  178. and t.status_cd= #{statusCd}
  179. </if>
  180. <if test="objName !=null and objName != ''">
  181. and t.obj_name= #{objName}
  182. </if>
  183. <if test="receivedAmount !=null and receivedAmount != ''">
  184. and t.received_amount= #{receivedAmount}
  185. </if>
  186. <if test="feeYear !=null and feeYear != ''">
  187. and t.fee_year= #{feeYear}
  188. </if>
  189. <if test="feeMonth !=null and feeMonth != ''">
  190. and t.fee_month= #{feeMonth}
  191. </if>
  192. <if test="feeId !=null and feeId != ''">
  193. and t.fee_id= #{feeId}
  194. </if>
  195. <if test="configId !=null and configId != ''">
  196. and t.config_id= #{configId}
  197. </if>
  198. <if test="objId !=null and objId != ''">
  199. and t.obj_id= #{objId}
  200. </if>
  201. <if test="feeName !=null and feeName != ''">
  202. and t.fee_name= #{feeName}
  203. </if>
  204. <if test="oweAmount !=null and oweAmount != ''">
  205. and t.owe_amount= #{oweAmount}
  206. </if>
  207. <if test="communityId !=null and communityId != ''">
  208. and t.community_id= #{communityId}
  209. </if>
  210. <if test="feeCreateTime !=null and feeCreateTime != ''">
  211. and t.fee_create_time= #{feeCreateTime}
  212. </if>
  213. <if test="objType !=null and objType != ''">
  214. and t.obj_type= #{objType}
  215. </if>
  216. </select>
  217. <!-- 查询费用月统计数量 add by wuxw 2018-07-03 -->
  218. <select id="queryReportFeeSummaryCount" parameterType="Map" resultType="Map">
  219. select count(1) count
  220. from (
  221. select t.fee_year,t.fee_month
  222. from report_fee_month_statistics t
  223. left join building_room br on t.obj_id = br.room_id and t.obj_type = '3333' and br.status_cd = '0'
  224. left join building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0'
  225. left join f_floor f on bu.floor_id = f.floor_id and f.status_cd = '0'
  226. where t.status_cd = '0'
  227. <if test="roomNum !=null and roomNum != ''">
  228. and br.room_num= #{roomNum}
  229. </if>
  230. <if test="unitId !=null and unitId != ''">
  231. and bu.unit_id= #{unitId}
  232. </if>
  233. <if test="floorId !=null and floorId != ''">
  234. and f.floor_id = #{floorId}
  235. </if>
  236. <if test="objName !=null and objName != ''">
  237. and t.obj_name= #{objName}
  238. </if>
  239. <if test="feeYear !=null and feeYear != ''">
  240. and t.fee_year= #{feeYear}
  241. </if>
  242. <if test="feeMonth !=null and feeMonth != ''">
  243. and t.fee_month= #{feeMonth}
  244. </if>
  245. <if test="feeId !=null and feeId != ''">
  246. and t.fee_id= #{feeId}
  247. </if>
  248. <if test="configId !=null and configId != ''">
  249. and t.config_id= #{configId}
  250. </if>
  251. <if test="objId !=null and objId != ''">
  252. and t.obj_id= #{objId}
  253. </if>
  254. <if test="feeName !=null and feeName != ''">
  255. and t.fee_name= #{feeName}
  256. </if>
  257. <if test="communityId !=null and communityId != ''">
  258. and t.community_id= #{communityId}
  259. </if>
  260. <if test="startTime !=null">
  261. and t.create_time &gt;= #{startTime}
  262. </if>
  263. <if test="endTime !=null">
  264. and t.create_time &lt;= #{endTime}
  265. </if>
  266. group by t.fee_year,t.fee_month
  267. ) t
  268. </select>
  269. <!-- 查询费用月统计信息 add by wuxw 2018-07-03 -->
  270. <select id="queryReportFeeSummary" parameterType="Map" resultType="Map">
  271. select t.fee_year feeYear,t.fee_month feeMonth,t.create_time createTime,SUM(t.receivable_amount)
  272. receivableAmount,SUM(t.received_amount)
  273. receivedAmount,SUM(t.owe_amount) oweAmount
  274. from report_fee_month_statistics t
  275. left join building_room br on t.obj_id = br.room_id and t.obj_type = '3333' and br.status_cd = '0'
  276. left join building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0'
  277. left join f_floor f on bu.floor_id = f.floor_id and f.status_cd = '0'
  278. where t.status_cd = '0'
  279. <if test="roomNum !=null and roomNum != ''">
  280. and br.room_num= #{roomNum}
  281. </if>
  282. <if test="unitId !=null and unitId != ''">
  283. and bu.unit_id= #{unitId}
  284. </if>
  285. <if test="floorId !=null and floorId != ''">
  286. and f.floor_id = #{floorId}
  287. </if>
  288. <if test="objName !=null and objName != ''">
  289. and t.obj_name= #{objName}
  290. </if>
  291. <if test="feeYear !=null and feeYear != ''">
  292. and t.fee_year= #{feeYear}
  293. </if>
  294. <if test="feeMonth !=null and feeMonth != ''">
  295. and t.fee_month= #{feeMonth}
  296. </if>
  297. <if test="feeId !=null and feeId != ''">
  298. and t.fee_id= #{feeId}
  299. </if>
  300. <if test="configId !=null and configId != ''">
  301. and t.config_id= #{configId}
  302. </if>
  303. <if test="objId !=null and objId != ''">
  304. and t.obj_id= #{objId}
  305. </if>
  306. <if test="feeName !=null and feeName != ''">
  307. and t.fee_name= #{feeName}
  308. </if>
  309. <if test="communityId !=null and communityId != ''">
  310. and t.community_id= #{communityId}
  311. </if>
  312. <if test="startTime !=null">
  313. and t.create_time &gt;= #{startTime}
  314. </if>
  315. <if test="endTime !=null">
  316. and t.create_time &lt;= #{endTime}
  317. </if>
  318. group by t.fee_year,t.fee_month
  319. <if test="page != -1 and page != null ">
  320. limit #{page}, #{row}
  321. </if>
  322. </select>
  323. <select id="queryReportFloorUnitFeeSummaryCount" parameterType="Map" resultType="Map">
  324. select count(1) count
  325. from (
  326. select t.fee_year feeYear,t.fee_month feeMonth, f.floor_num flooNum, bu.unit_num unitNum
  327. from report_fee_month_statistics t
  328. INNER JOIN building_room br on t.obj_id = br.room_id and br.status_cd = '0'
  329. inner join building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0'
  330. inner join f_floor f on bu.floor_id = f.floor_id and f.status_cd = '0'
  331. where t.status_cd = '0'
  332. <if test="roomNum !=null and roomNum != ''">
  333. and br.room_num= #{roomNum}
  334. </if>
  335. <if test="unitId !=null and unitId != ''">
  336. and bu.unit_id= #{unitId}
  337. </if>
  338. <if test="floorId !=null and floorId != ''">
  339. and f.floor_id = #{floorId}
  340. </if>
  341. <if test="objName !=null and objName != ''">
  342. and t.obj_name= #{objName}
  343. </if>
  344. <if test="feeYear !=null and feeYear != ''">
  345. and t.fee_year= #{feeYear}
  346. </if>
  347. <if test="feeMonth !=null and feeMonth != ''">
  348. and t.fee_month= #{feeMonth}
  349. </if>
  350. <if test="feeId !=null and feeId != ''">
  351. and t.fee_id= #{feeId}
  352. </if>
  353. <if test="configId !=null and configId != ''">
  354. and t.config_id= #{configId}
  355. </if>
  356. <if test="objId !=null and objId != ''">
  357. and t.obj_id= #{objId}
  358. </if>
  359. <if test="feeName !=null and feeName != ''">
  360. and t.fee_name= #{feeName}
  361. </if>
  362. <if test="communityId !=null and communityId != ''">
  363. and t.community_id= #{communityId}
  364. </if>
  365. <if test="startTime !=null">
  366. and t.create_time &gt;= #{startTime}
  367. </if>
  368. <if test="endTime !=null">
  369. and t.create_time &lt;= #{endTime}
  370. </if>
  371. GROUP BY t.fee_year,t.fee_month,f.floor_num,bu.unit_id,bu.unit_num
  372. ) t
  373. </select>
  374. <!-- 查询费用月统计信息 add by wuxw 2018-07-03 -->
  375. <select id="queryReportFloorUnitFeeSummary" parameterType="Map" resultType="Map">
  376. select t.fee_year feeYear,t.fee_month feeMonth, f.floor_num floorNum, bu.unit_num unitNum,t.create_time
  377. createTime,
  378. SUM(t.receivable_amount) receivableAmount,SUM(t.received_amount) receivedAmount,SUM(t.owe_amount) oweAmount
  379. from report_fee_month_statistics t
  380. INNER JOIN building_room br on t.obj_id = br.room_id and br.status_cd = '0'
  381. inner join building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0'
  382. inner join f_floor f on bu.floor_id = f.floor_id and f.status_cd = '0'
  383. where t.status_cd = '0'
  384. <if test="roomNum !=null and roomNum != ''">
  385. and br.room_num= #{roomNum}
  386. </if>
  387. <if test="unitId !=null and unitId != ''">
  388. and bu.unit_id= #{unitId}
  389. </if>
  390. <if test="floorId !=null and floorId != ''">
  391. and f.floor_id = #{floorId}
  392. </if>
  393. <if test="objName !=null and objName != ''">
  394. and t.obj_name= #{objName}
  395. </if>
  396. <if test="feeYear !=null and feeYear != ''">
  397. and t.fee_year= #{feeYear}
  398. </if>
  399. <if test="feeMonth !=null and feeMonth != ''">
  400. and t.fee_month= #{feeMonth}
  401. </if>
  402. <if test="feeId !=null and feeId != ''">
  403. and t.fee_id= #{feeId}
  404. </if>
  405. <if test="configId !=null and configId != ''">
  406. and t.config_id= #{configId}
  407. </if>
  408. <if test="objId !=null and objId != ''">
  409. and t.obj_id= #{objId}
  410. </if>
  411. <if test="feeName !=null and feeName != ''">
  412. and t.fee_name= #{feeName}
  413. </if>
  414. <if test="communityId !=null and communityId != ''">
  415. and t.community_id= #{communityId}
  416. </if>
  417. <if test="startTime !=null">
  418. and t.create_time &gt;= #{startTime}
  419. </if>
  420. <if test="endTime !=null">
  421. and t.create_time &lt;= #{endTime}
  422. </if>
  423. GROUP BY t.fee_year,t.fee_month,f.floor_num,bu.unit_id,bu.unit_num
  424. <if test="page != -1 and page != null ">
  425. limit #{page}, #{row}
  426. </if>
  427. </select>
  428. <select id="queryFeeBreakdownCount" parameterType="Map" resultType="Map">
  429. select count(1) count
  430. from (
  431. select t.fee_name feeName,td.name feeTypeCd,pfc.fee_type_cd,pfc.start_time feeCreateTime,t.create_time createTime,SUM(t.receivable_amount)
  432. receivableAmount,SUM(t.received_amount) receivedAmount,SUM(t.owe_amount) oweAmount
  433. from report_fee_month_statistics t
  434. inner join pay_fee_config pfc on t.config_id = pfc.config_id and pfc.status_cd = '0'
  435. left join building_room br on t.obj_id = br.room_id and t.obj_type = '3333' and br.status_cd = '0'
  436. left join building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0'
  437. left join f_floor f on bu.floor_id = f.floor_id and f.status_cd = '0'
  438. left join t_dict td on pfc.fee_type_cd = td.status_cd and td.table_name="pay_fee_config" and td.table_columns="fee_type_cd"
  439. where t.status_cd = '0'
  440. <if test="roomNum !=null and roomNum != ''">
  441. and br.room_num= #{roomNum}
  442. </if>
  443. <if test="unitId !=null and unitId != ''">
  444. and bu.unit_id= #{unitId}
  445. </if>
  446. <if test="floorId !=null and floorId != ''">
  447. and f.floor_id = #{floorId}
  448. </if>
  449. <if test="objName !=null and objName != ''">
  450. and t.obj_name= #{objName}
  451. </if>
  452. <if test="feeYear !=null and feeYear != ''">
  453. and t.fee_year= #{feeYear}
  454. </if>
  455. <if test="feeMonth !=null and feeMonth != ''">
  456. and t.fee_month= #{feeMonth}
  457. </if>
  458. <if test="feeId !=null and feeId != ''">
  459. and t.fee_id= #{feeId}
  460. </if>
  461. <if test="configId !=null and configId != ''">
  462. and pfc.config_id= #{configId}
  463. </if>
  464. <if test="objId !=null and objId != ''">
  465. and t.obj_id= #{objId}
  466. </if>
  467. <if test="feeName !=null and feeName != ''">
  468. and t.fee_name= #{feeName}
  469. </if>
  470. <if test="feeTypeCd != null and feeTypeCd != ''">
  471. and pfc.fee_type_cd = #{feeTypeCd}
  472. </if>
  473. <if test="communityId !=null and communityId != ''">
  474. and t.community_id= #{communityId}
  475. </if>
  476. <if test="startTime !=null">
  477. and t.create_time &gt;= #{startTime}
  478. </if>
  479. <if test="endTime !=null">
  480. and t.create_time &lt;= #{endTime}
  481. </if>
  482. group by t.config_id,t.fee_name,pfc.start_time
  483. ) t
  484. </select>
  485. <!-- 查询费用月统计信息 add by wuxw 2018-07-03 -->
  486. <select id="queryFeeBreakdown" parameterType="Map" resultType="Map">
  487. select t.fee_name feeName,td.name feeTypeCd,pfc.fee_type_cd,pfc.start_time feeCreateTime,t.create_time createTime,SUM(t.receivable_amount)
  488. receivableAmount,SUM(t.received_amount) receivedAmount,SUM(t.owe_amount) oweAmount
  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. left join building_room br on t.obj_id = br.room_id and t.obj_type = '3333' and br.status_cd = '0'
  492. left join building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0'
  493. left join f_floor f on bu.floor_id = f.floor_id and f.status_cd = '0'
  494. left join t_dict td on pfc.fee_type_cd = td.status_cd and td.table_name="pay_fee_config" and td.table_columns="fee_type_cd"
  495. where t.status_cd = '0'
  496. <if test="roomNum !=null and roomNum != ''">
  497. and br.room_num= #{roomNum}
  498. </if>
  499. <if test="unitId !=null and unitId != ''">
  500. and bu.unit_id= #{unitId}
  501. </if>
  502. <if test="floorId !=null and floorId != ''">
  503. and f.floor_id = #{floorId}
  504. </if>
  505. <if test="objName !=null and objName != ''">
  506. and t.obj_name= #{objName}
  507. </if>
  508. <if test="feeYear !=null and feeYear != ''">
  509. and t.fee_year= #{feeYear}
  510. </if>
  511. <if test="feeMonth !=null and feeMonth != ''">
  512. and t.fee_month= #{feeMonth}
  513. </if>
  514. <if test="feeId !=null and feeId != ''">
  515. and t.fee_id= #{feeId}
  516. </if>
  517. <if test="configId !=null and configId != ''">
  518. and pfc.config_id= #{configId}
  519. </if>
  520. <if test="objId !=null and objId != ''">
  521. and t.obj_id= #{objId}
  522. </if>
  523. <if test="feeName !=null and feeName != ''">
  524. and t.fee_name= #{feeName}
  525. </if>
  526. <if test="feeTypeCd != null and feeTypeCd != ''">
  527. and pfc.fee_type_cd = #{feeTypeCd}
  528. </if>
  529. <if test="communityId !=null and communityId != ''">
  530. and t.community_id= #{communityId}
  531. </if>
  532. <if test="startTime !=null">
  533. and t.create_time &gt;= #{startTime}
  534. </if>
  535. <if test="endTime !=null">
  536. and t.create_time &lt;= #{endTime}
  537. </if>
  538. group by t.config_id,t.fee_name,pfc.start_time
  539. <if test="page != -1 and page != null ">
  540. limit #{page}, #{row}
  541. </if>
  542. </select>
  543. <select id="queryFeeDetailCount" parameterType="Map" resultType="Map">
  544. select count(1) count
  545. from (
  546. select t.obj_name objName,t.fee_name feeName,pfc.start_time
  547. from report_fee_month_statistics t
  548. inner join pay_fee_config pfc on t.config_id = pfc.config_id and pfc.status_cd = '0'
  549. left join building_room br on t.obj_id = br.room_id and t.obj_type = '3333' and br.status_cd = '0'
  550. left join building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0'
  551. left join f_floor f on bu.floor_id = f.floor_id and f.status_cd = '0'
  552. where t.status_cd = '0'
  553. <if test="roomNum !=null and roomNum != ''">
  554. and br.room_num= #{roomNum}
  555. </if>
  556. <if test="unitId !=null and unitId != ''">
  557. and bu.unit_id= #{unitId}
  558. </if>
  559. <if test="floorId !=null and floorId != ''">
  560. and f.floor_id = #{floorId}
  561. </if>
  562. <if test="objName !=null and objName != ''">
  563. and t.obj_name= #{objName}
  564. </if>
  565. <if test="feeYear !=null and feeYear != ''">
  566. and t.fee_year= #{feeYear}
  567. </if>
  568. <if test="feeMonth !=null and feeMonth != ''">
  569. and t.fee_month= #{feeMonth}
  570. </if>
  571. <if test="feeId !=null and feeId != ''">
  572. and t.fee_id= #{feeId}
  573. </if>
  574. <if test="configId !=null and configId != ''">
  575. and t.config_id= #{configId}
  576. </if>
  577. <if test="objId !=null and objId != ''">
  578. and t.obj_id= #{objId}
  579. </if>
  580. <if test="feeName !=null and feeName != ''">
  581. and t.fee_name= #{feeName}
  582. </if>
  583. <if test="communityId !=null and communityId != ''">
  584. and t.community_id= #{communityId}
  585. </if>
  586. <if test="startTime !=null">
  587. and t.create_time &gt;= #{startTime}
  588. </if>
  589. <if test="endTime !=null">
  590. and t.create_time &lt;= #{endTime}
  591. </if>
  592. group by t.config_id,t.fee_name,t.fee_create_time,t.obj_id,t.obj_name,t.deadline_time
  593. ) t
  594. </select>
  595. <!-- 查询费用月统计信息 add by wuxw 2018-07-03 -->
  596. <select id="queryFeeDetail" parameterType="Map" resultType="Map">
  597. select t.obj_name objName,t.fee_name feeName,t.fee_create_time feeCreateTime,t.deadline_time
  598. deadlineTime,t.create_time createTime,SUM(t.receivable_amount) receivableAmount,SUM(t.received_amount)
  599. receivedAmount,SUM(t.owe_amount) oweAmount
  600. from report_fee_month_statistics t
  601. inner join pay_fee_config pfc on t.config_id = pfc.config_id and pfc.status_cd = '0'
  602. left join building_room br on t.obj_id = br.room_id and t.obj_type = '3333' and br.status_cd = '0'
  603. left join building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0'
  604. left join f_floor f on bu.floor_id = f.floor_id and f.status_cd = '0'
  605. where t.status_cd = '0'
  606. <if test="roomNum !=null and roomNum != ''">
  607. and br.room_num= #{roomNum}
  608. </if>
  609. <if test="unitId !=null and unitId != ''">
  610. and bu.unit_id= #{unitId}
  611. </if>
  612. <if test="floorId !=null and floorId != ''">
  613. and f.floor_id = #{floorId}
  614. </if>
  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,t.fee_create_time,t.obj_id,t.obj_name,t.deadline_time
  646. <if test="page != -1 and page != null ">
  647. limit #{page}, #{row}
  648. </if>
  649. </select>
  650. <!-- 查询费用月统计信息 add by wuxw 2018-07-03 -->
  651. <select id="queryAllFeeDetail" parameterType="Map" resultType="Map">
  652. select SUM(t.receivable_amount) allReceivableAmount,SUM(t.received_amount) allReceivedAmount,
  653. SUM(t.owe_amount) allOweAmount from report_fee_month_statistics t
  654. inner join pay_fee_config pfc on t.config_id = pfc.config_id and pfc.status_cd = '0'
  655. left join building_room br on t.obj_id = br.room_id and t.obj_type = '3333' and br.status_cd = '0'
  656. left join building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0'
  657. left join f_floor f on bu.floor_id = f.floor_id and f.status_cd = '0'
  658. where t.status_cd = '0'
  659. <if test="roomNum !=null and roomNum != ''">
  660. and br.room_num= #{roomNum}
  661. </if>
  662. <if test="unitId !=null and unitId != ''">
  663. and bu.unit_id= #{unitId}
  664. </if>
  665. <if test="floorId !=null and floorId != ''">
  666. and f.floor_id = #{floorId}
  667. </if>
  668. <if test="objName !=null and objName != ''">
  669. and t.obj_name= #{objName}
  670. </if>
  671. <if test="feeYear !=null and feeYear != ''">
  672. and t.fee_year= #{feeYear}
  673. </if>
  674. <if test="feeMonth !=null and feeMonth != ''">
  675. and t.fee_month= #{feeMonth}
  676. </if>
  677. <if test="feeId !=null and feeId != ''">
  678. and t.fee_id= #{feeId}
  679. </if>
  680. <if test="configId !=null and configId != ''">
  681. and t.config_id= #{configId}
  682. </if>
  683. <if test="objId !=null and objId != ''">
  684. and t.obj_id= #{objId}
  685. </if>
  686. <if test="feeName !=null and feeName != ''">
  687. and t.fee_name= #{feeName}
  688. </if>
  689. <if test="communityId !=null and communityId != ''">
  690. and t.community_id= #{communityId}
  691. </if>
  692. <if test="startTime !=null">
  693. and t.create_time &gt;= #{startTime}
  694. </if>
  695. <if test="endTime !=null">
  696. and t.create_time &lt;= #{endTime}
  697. </if>
  698. </select>
  699. <select id="queryOweFeeDetailCount" parameterType="Map" resultType="Map">
  700. select count(1) count
  701. from (
  702. select t.obj_name objName,t.fee_name feeName,pfc.start_time,SUM(t.owe_amount) oweAmount
  703. from report_fee_month_statistics t
  704. inner join pay_fee_config pfc on t.config_id = pfc.config_id and pfc.status_cd = '0'
  705. left join building_room br on t.obj_id = br.room_id and t.obj_type = '3333' and br.status_cd = '0'
  706. left join building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0'
  707. left join f_floor f on bu.floor_id = f.floor_id and f.status_cd = '0'
  708. where t.status_cd = '0'
  709. <if test="roomNum !=null and roomNum != ''">
  710. and br.room_num= #{roomNum}
  711. </if>
  712. <if test="unitId !=null and unitId != ''">
  713. and bu.unit_id= #{unitId}
  714. </if>
  715. <if test="floorId !=null and floorId != ''">
  716. and f.floor_id = #{floorId}
  717. </if>
  718. <if test="objName !=null and objName != ''">
  719. and t.obj_name= #{objName}
  720. </if>
  721. <if test="feeYear !=null and feeYear != ''">
  722. and t.fee_year= #{feeYear}
  723. </if>
  724. <if test="feeMonth !=null and feeMonth != ''">
  725. and t.fee_month= #{feeMonth}
  726. </if>
  727. <if test="feeId !=null and feeId != ''">
  728. and t.fee_id= #{feeId}
  729. </if>
  730. <if test="configId !=null and configId != ''">
  731. and t.config_id= #{configId}
  732. </if>
  733. <if test="objId !=null and objId != ''">
  734. and t.obj_id= #{objId}
  735. </if>
  736. <if test="feeName !=null and feeName != ''">
  737. and t.fee_name= #{feeName}
  738. </if>
  739. <if test="communityId !=null and communityId != ''">
  740. and t.community_id= #{communityId}
  741. </if>
  742. <if test="startTime !=null">
  743. and t.create_time &gt;= #{startTime}
  744. </if>
  745. <if test="endTime !=null">
  746. and t.create_time &lt;= #{endTime}
  747. </if>
  748. group by t.config_id,t.fee_name,pfc.start_time,t.obj_id,t.obj_name
  749. HAVING oweAmount > 0
  750. ) t
  751. </select>
  752. <!-- 查询费用月统计信息 add by wuxw 2018-07-03 -->
  753. <select id="queryOweFeeDetail" parameterType="Map" resultType="Map">
  754. select t.obj_name objName,t.fee_name feeName,t.fee_create_time feeCreateTime,t.create_time
  755. createTime,SUM(t.receivable_amount)
  756. receivableAmount,SUM(t.received_amount) receivedAmount,SUM(t.owe_amount) oweAmount
  757. from report_fee_month_statistics t
  758. inner join pay_fee_config pfc on t.config_id = pfc.config_id and pfc.status_cd = '0'
  759. left join building_room br on t.obj_id = br.room_id and t.obj_type = '3333' and br.status_cd = '0'
  760. left join building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0'
  761. left join f_floor f on bu.floor_id = f.floor_id and f.status_cd = '0'
  762. where t.status_cd = '0'
  763. <if test="roomNum !=null and roomNum != ''">
  764. and br.room_num= #{roomNum}
  765. </if>
  766. <if test="unitId !=null and unitId != ''">
  767. and bu.unit_id= #{unitId}
  768. </if>
  769. <if test="floorId !=null and floorId != ''">
  770. and f.floor_id = #{floorId}
  771. </if>
  772. <if test="objName !=null and objName != ''">
  773. and t.obj_name= #{objName}
  774. </if>
  775. <if test="feeYear !=null and feeYear != ''">
  776. and t.fee_year= #{feeYear}
  777. </if>
  778. <if test="feeMonth !=null and feeMonth != ''">
  779. and t.fee_month= #{feeMonth}
  780. </if>
  781. <if test="feeId !=null and feeId != ''">
  782. and t.fee_id= #{feeId}
  783. </if>
  784. <if test="configId !=null and configId != ''">
  785. and t.config_id= #{configId}
  786. </if>
  787. <if test="objId !=null and objId != ''">
  788. and t.obj_id= #{objId}
  789. </if>
  790. <if test="feeName !=null and feeName != ''">
  791. and t.fee_name= #{feeName}
  792. </if>
  793. <if test="communityId !=null and communityId != ''">
  794. and t.community_id= #{communityId}
  795. </if>
  796. <if test="startTime !=null">
  797. and t.create_time &gt;= #{startTime}
  798. </if>
  799. <if test="endTime !=null">
  800. and t.create_time &lt;= #{endTime}
  801. </if>
  802. group by t.config_id,t.fee_name,pfc.start_time,t.obj_id,t.obj_name
  803. HAVING oweAmount > 0
  804. <if test="page != -1 and page != null ">
  805. limit #{page}, #{row}
  806. </if>
  807. </select>
  808. <select id="queryPayFeeDetailCount" parameterType="Map" resultType="Map">
  809. select count(1) count,SUM(receivedAmount) totalReceivedAmount,SUM(receivableAmount) totalReceivableAmount
  810. from (
  811. select pfc.fee_name feeName,f.floor_num floorNum,bu.unit_num unitNum,br.room_num roomNum,oc.car_num carNum,
  812. pf.payer_obj_type payerObjType,t.start_time startTime,t.end_time endTime,t.create_time createTime,
  813. t.receivable_amount receivableAmount,t.received_amount receivedAmount,d.name
  814. from pay_fee_detail t
  815. INNER JOIN pay_fee pf on t.fee_id = pf.fee_id and pf.status_cd = '0'
  816. inner join pay_fee_config pfc on pf.config_id = pfc.config_id and pfc.status_cd = '0'
  817. left join building_room br on pf.payer_obj_id = br.room_id and pf.payer_obj_type = '3333' and br.status_cd = '0'
  818. left join building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0'
  819. left join f_floor f on bu.floor_id = f.floor_id and f.status_cd = '0'
  820. left join owner_car oc on pf.payer_obj_id = oc.car_id and oc.status_cd = '0'
  821. left join t_dict d on t.prime_rate = d.status_cd and d.table_name="pay_fee_detail" and
  822. d.table_columns="prime_rate"
  823. where t.status_cd = '0'
  824. <if test="roomNum !=null and roomNum != ''">
  825. and br.room_num= #{roomNum}
  826. </if>
  827. <if test="unitId !=null and unitId != ''">
  828. and bu.unit_id= #{unitId}
  829. </if>
  830. <if test="floorId !=null and floorId != ''">
  831. and f.floor_id = #{floorId}
  832. </if>
  833. <if test="objName !=null and objName != ''">
  834. and t.obj_name= #{objName}
  835. </if>
  836. <if test="feeYear !=null and feeYear != ''">
  837. and t.fee_year= #{feeYear}
  838. </if>
  839. <if test="feeMonth !=null and feeMonth != ''">
  840. and t.fee_month= #{feeMonth}
  841. </if>
  842. <if test="feeId !=null and feeId != ''">
  843. and t.fee_id= #{feeId}
  844. </if>
  845. <if test="configId !=null and configId != ''">
  846. and pfc.config_id= #{configId}
  847. </if>
  848. <if test="objId !=null and objId != ''">
  849. and t.obj_id= #{objId}
  850. </if>
  851. <if test="feeName !=null and feeName != ''">
  852. and t.fee_name= #{feeName}
  853. </if>
  854. <if test="communityId !=null and communityId != ''">
  855. and t.community_id= #{communityId}
  856. </if>
  857. <if test="primeRate != null and primeRate != ''">
  858. and t.prime_rate = #{primeRate}
  859. </if>
  860. <if test="startTime !=null">
  861. and t.create_time &gt;= #{startTime}
  862. </if>
  863. <if test="endTime !=null">
  864. and t.create_time &lt;= #{endTime}
  865. </if>
  866. ) t
  867. </select>
  868. <!-- 查询费用月统计信息 add by wuxw 2018-07-03 -->
  869. <select id="queryPayFeeDetail" parameterType="Map" resultType="Map">
  870. select pfc.fee_name feeName,f.floor_num floorNum,bu.unit_num unitNum,br.room_num roomNum,oc.car_num carNum,
  871. pf.payer_obj_type payerObjType,t.start_time startTime,t.end_time endTime,t.create_time createTime,
  872. t.receivable_amount receivableAmount,t.received_amount receivedAmount,pfa.`value`
  873. importFeeName,t.prime_rate,d.name primeRate
  874. from pay_fee_detail t
  875. INNER JOIN pay_fee pf on t.fee_id = pf.fee_id and pf.status_cd = '0'
  876. inner join pay_fee_config pfc on pf.config_id = pfc.config_id and pfc.status_cd = '0'
  877. left join building_room br on pf.payer_obj_id = br.room_id and pf.payer_obj_type = '3333' and br.status_cd = '0'
  878. left join building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0'
  879. left join f_floor f on bu.floor_id = f.floor_id and f.status_cd = '0'
  880. left join owner_car oc on pf.payer_obj_id = oc.car_id and oc.status_cd = '0'
  881. left join pay_fee_attrs pfa on t.fee_id = pfa.fee_id and pfa.spec_cd = '390002'
  882. left join t_dict d on t.prime_rate = d.status_cd and d.table_name="pay_fee_detail" and
  883. d.table_columns="prime_rate"
  884. where t.status_cd = '0'
  885. <if test="roomNum !=null and roomNum != ''">
  886. and br.room_num= #{roomNum}
  887. </if>
  888. <if test="unitId !=null and unitId != ''">
  889. and bu.unit_id= #{unitId}
  890. </if>
  891. <if test="floorId !=null and floorId != ''">
  892. and f.floor_id = #{floorId}
  893. </if>
  894. <if test="objName !=null and objName != ''">
  895. and t.obj_name= #{objName}
  896. </if>
  897. <if test="feeYear !=null and feeYear != ''">
  898. and t.fee_year= #{feeYear}
  899. </if>
  900. <if test="feeMonth !=null and feeMonth != ''">
  901. and t.fee_month= #{feeMonth}
  902. </if>
  903. <if test="feeId !=null and feeId != ''">
  904. and t.fee_id= #{feeId}
  905. </if>
  906. <if test="configId !=null and configId != ''">
  907. and pfc.config_id= #{configId}
  908. </if>
  909. <if test="objId !=null and objId != ''">
  910. and t.obj_id= #{objId}
  911. </if>
  912. <if test="feeName !=null and feeName != ''">
  913. and t.fee_name= #{feeName}
  914. </if>
  915. <if test="communityId !=null and communityId != ''">
  916. and t.community_id= #{communityId}
  917. </if>
  918. <if test="primeRate != null and primeRate != ''">
  919. and t.prime_rate = #{primeRate}
  920. </if>
  921. <if test="startTime !=null">
  922. and t.create_time &gt;= #{startTime}
  923. </if>
  924. <if test="endTime !=null">
  925. and t.create_time &lt;= #{endTime}
  926. </if>
  927. order by t.create_time desc
  928. <if test="page != -1 and page != null ">
  929. limit #{page}, #{row}
  930. </if>
  931. </select>
  932. <select id="queryAllPayFeeDetail" parameterType="Map" resultType="Map">
  933. select SUM(t.receivable_amount) allReceivableAmount,SUM(t.received_amount) allReceivedAmount
  934. from pay_fee_detail t
  935. INNER JOIN pay_fee pf on t.fee_id = pf.fee_id and pf.status_cd = '0'
  936. inner join pay_fee_config pfc on pf.config_id = pfc.config_id and pfc.status_cd = '0'
  937. left join building_room br on pf.payer_obj_id = br.room_id and pf.payer_obj_type = '3333' and br.status_cd = '0'
  938. left join building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0'
  939. left join f_floor f on bu.floor_id = f.floor_id and f.status_cd = '0'
  940. left join owner_car oc on pf.payer_obj_id = oc.car_id and oc.status_cd = '0'
  941. left join pay_fee_attrs pfa on t.fee_id = pfa.fee_id and pfa.spec_cd = '390002'
  942. where t.status_cd = '0'
  943. <if test="roomNum !=null and roomNum != ''">
  944. and br.room_num= #{roomNum}
  945. </if>
  946. <if test="unitId !=null and unitId != ''">
  947. and bu.unit_id= #{unitId}
  948. </if>
  949. <if test="floorId !=null and floorId != ''">
  950. and f.floor_id = #{floorId}
  951. </if>
  952. <if test="objName !=null and objName != ''">
  953. and t.obj_name= #{objName}
  954. </if>
  955. <if test="feeYear !=null and feeYear != ''">
  956. and t.fee_year= #{feeYear}
  957. </if>
  958. <if test="feeMonth !=null and feeMonth != ''">
  959. and t.fee_month= #{feeMonth}
  960. </if>
  961. <if test="feeId !=null and feeId != ''">
  962. and t.fee_id= #{feeId}
  963. </if>
  964. <if test="configId !=null and configId != ''">
  965. and pfc.config_id= #{configId}
  966. </if>
  967. <if test="objId !=null and objId != ''">
  968. and t.obj_id= #{objId}
  969. </if>
  970. <if test="feeName !=null and feeName != ''">
  971. and t.fee_name= #{feeName}
  972. </if>
  973. <if test="communityId !=null and communityId != ''">
  974. and t.community_id= #{communityId}
  975. </if>
  976. <if test="primeRate != null and primeRate != ''">
  977. and t.prime_rate = #{primeRate}
  978. </if>
  979. <if test="startTime !=null">
  980. and t.create_time &gt;= #{startTime}
  981. </if>
  982. <if test="endTime !=null">
  983. and t.create_time &lt;= #{endTime}
  984. </if>
  985. </select>
  986. <select id="queryDeadlineFeeCount" parameterType="Map" resultType="Map">
  987. select count(1) count
  988. from (
  989. SELECT
  990. t.obj_name objName,
  991. t.fee_name feeName,
  992. t.deadline_time deadlineTime
  993. FROM
  994. report_fee_month_statistics t
  995. inner join pay_fee_config pfc on t.config_id = pfc.config_id and pfc.status_cd = '0'
  996. left join building_room br on t.obj_id = br.room_id and t.obj_type = '3333' and br.status_cd = '0'
  997. left join building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0'
  998. left join f_floor f on bu.floor_id = f.floor_id and f.status_cd = '0'
  999. where t.status_cd = '0'
  1000. <if test="roomNum !=null and roomNum != ''">
  1001. and br.room_num= #{roomNum}
  1002. </if>
  1003. <if test="unitId !=null and unitId != ''">
  1004. and bu.unit_id= #{unitId}
  1005. </if>
  1006. <if test="floorId !=null and floorId != ''">
  1007. and f.floor_id = #{floorId}
  1008. </if>
  1009. <if test="objName !=null and objName != ''">
  1010. and t.obj_name= #{objName}
  1011. </if>
  1012. <if test="feeYear !=null and feeYear != ''">
  1013. and t.fee_year= #{feeYear}
  1014. </if>
  1015. <if test="feeMonth !=null and feeMonth != ''">
  1016. and t.fee_month= #{feeMonth}
  1017. </if>
  1018. <if test="feeId !=null and feeId != ''">
  1019. and t.fee_id= #{feeId}
  1020. </if>
  1021. <if test="configId !=null and configId != ''">
  1022. and t.config_id= #{configId}
  1023. </if>
  1024. <if test="objId !=null and objId != ''">
  1025. and t.obj_id= #{objId}
  1026. </if>
  1027. <if test="feeName !=null and feeName != ''">
  1028. and t.fee_name= #{feeName}
  1029. </if>
  1030. <if test="communityId !=null and communityId != ''">
  1031. and t.community_id= #{communityId}
  1032. </if>
  1033. <if test="startTime !=null">
  1034. and t.deadline_time &gt;= #{startTime}
  1035. </if>
  1036. <if test="endTime !=null">
  1037. and t.deadline_time &lt;= #{endTime}
  1038. </if>
  1039. ) t
  1040. </select>
  1041. <!-- 查询费用月统计信息 add by wuxw 2018-07-03 -->
  1042. <select id="queryDeadlineFee" parameterType="Map" resultType="Map">
  1043. SELECT
  1044. t.obj_name objName,
  1045. t.fee_name feeName,
  1046. t.deadline_time deadlineTime
  1047. FROM
  1048. report_fee_month_statistics t
  1049. inner join pay_fee_config pfc on t.config_id = pfc.config_id and pfc.status_cd = '0'
  1050. left join building_room br on t.obj_id = br.room_id and t.obj_type = '3333' and br.status_cd = '0'
  1051. left join building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0'
  1052. left join f_floor f on bu.floor_id = f.floor_id and f.status_cd = '0'
  1053. where t.status_cd = '0'
  1054. <if test="roomNum !=null and roomNum != ''">
  1055. and br.room_num= #{roomNum}
  1056. </if>
  1057. <if test="unitId !=null and unitId != ''">
  1058. and bu.unit_id= #{unitId}
  1059. </if>
  1060. <if test="floorId !=null and floorId != ''">
  1061. and f.floor_id = #{floorId}
  1062. </if>
  1063. <if test="objName !=null and objName != ''">
  1064. and t.obj_name= #{objName}
  1065. </if>
  1066. <if test="feeYear !=null and feeYear != ''">
  1067. and t.fee_year= #{feeYear}
  1068. </if>
  1069. <if test="feeMonth !=null and feeMonth != ''">
  1070. and t.fee_month= #{feeMonth}
  1071. </if>
  1072. <if test="feeId !=null and feeId != ''">
  1073. and t.fee_id= #{feeId}
  1074. </if>
  1075. <if test="configId !=null and configId != ''">
  1076. and t.config_id= #{configId}
  1077. </if>
  1078. <if test="objId !=null and objId != ''">
  1079. and t.obj_id= #{objId}
  1080. </if>
  1081. <if test="feeName !=null and feeName != ''">
  1082. and t.fee_name= #{feeName}
  1083. </if>
  1084. <if test="communityId !=null and communityId != ''">
  1085. and t.community_id= #{communityId}
  1086. </if>
  1087. <if test="startTime !=null">
  1088. and t.deadline_time &gt;= #{startTime}
  1089. </if>
  1090. <if test="endTime !=null">
  1091. and t.deadline_time &lt;= #{endTime}
  1092. </if>
  1093. order by t.deadline_time
  1094. <if test="page != -1 and page != null ">
  1095. limit #{page}, #{row}
  1096. </if>
  1097. </select>
  1098. <select id="queryPrePaymentNewCount" parameterType="Map" resultType="Map">
  1099. select count(1) count
  1100. from (
  1101. select pfc.fee_name feeName, f.floor_num floorNum,bu.unit_num unitNum,br.room_num roomNum,t.end_time endTime
  1102. ,oc.car_num carNum
  1103. from pay_fee t
  1104. inner join pay_fee_config pfc on t.config_id = pfc.config_id and pfc.status_cd = '0'
  1105. left join building_room br on t.payer_obj_id = br.room_id and t.payer_obj_type = '3333' and br.status_cd = '0'
  1106. left join building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0'
  1107. left join f_floor f on f.floor_id = bu.floor_id and f.status_cd = '0'
  1108. left join owner_car oc on t.payer_obj_id = oc.car_id and t.payer_obj_type = '6666' and oc.status_cd = '0'
  1109. where t.state = '2008001'
  1110. and t.status_cd = '0'
  1111. <if test="communityId !=null and communityId != ''">
  1112. and t.community_id= #{communityId}
  1113. </if>
  1114. <if test="startTime !=null">
  1115. and t.end_time &gt;= #{startTime}
  1116. </if>
  1117. <if test="endTime !=null">
  1118. and t.end_time &lt;= #{endTime}
  1119. </if>
  1120. ) t
  1121. </select>
  1122. <!-- 查询费用月统计信息 add by wuxw 2018-07-03 -->
  1123. <select id="queryPrePayment" parameterType="Map" resultType="Map">
  1124. select pfc.fee_name feeName, f.floor_num floorNum,bu.unit_num unitNum,br.room_num roomNum,t.end_time endTime ,
  1125. oc.car_num carNum,t.payer_obj_type payerObjType
  1126. from pay_fee t
  1127. inner join pay_fee_config pfc on t.config_id = pfc.config_id and pfc.status_cd = '0'
  1128. left join building_room br on t.payer_obj_id = br.room_id and t.payer_obj_type = '3333' and br.status_cd = '0'
  1129. left join building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0'
  1130. left join f_floor f on f.floor_id = bu.floor_id and f.status_cd = '0'
  1131. left join owner_car oc on t.payer_obj_id = oc.car_id and t.payer_obj_type = '6666' and oc.status_cd = '0'
  1132. where t.state = '2008001'
  1133. and t.status_cd = '0'
  1134. <if test="communityId !=null and communityId != ''">
  1135. and t.community_id= #{communityId}
  1136. </if>
  1137. <if test="startTime !=null">
  1138. and t.end_time &gt;= #{startTime}
  1139. </if>
  1140. <if test="endTime !=null">
  1141. and t.end_time &lt;= #{endTime}
  1142. </if>
  1143. <if test="page != -1 and page != null ">
  1144. limit #{page}, #{row}
  1145. </if>
  1146. </select>
  1147. <select id="queryPrePaymentCount" parameterType="Map" resultType="Map">
  1148. select pfc.fee_name feeName,count(t.payer_obj_id) objCount from pay_fee t
  1149. inner join pay_fee_config pfc on t.config_id = pfc.config_id and pfc.status_cd = '0'
  1150. where t.state = '2008001'
  1151. and t.status_cd = '0'
  1152. and t.end_time &gt; #{startTime}
  1153. and t.end_time &lt; #{endTime}
  1154. and t.community_id= #{communityId}
  1155. group by pfc.fee_name ,pfc.config_id
  1156. order by objCount
  1157. </select>
  1158. <select id="queryDeadlinePaymentCount" parameterType="Map" resultType="Map">
  1159. SELECT
  1160. t.fee_name feeName,
  1161. count(t.obj_id) objCount
  1162. FROM
  1163. report_fee_month_statistics t
  1164. WHERE
  1165. 1 = 1
  1166. AND t.status_cd = '0'
  1167. and t.community_id= #{communityId}
  1168. AND t.deadline_time &gt; #{startTime}
  1169. AND t.deadline_time &lt; #{endTime}
  1170. group by t.config_id,t.fee_name
  1171. order by objCount desc
  1172. </select>
  1173. <select id="queryOwePaymentCount" parameterType="Map" resultType="Map">
  1174. select t.fee_name feeName,count( distinct t.obj_id) objCount
  1175. from report_fee_month_statistics t
  1176. where t.community_id = #{communityId}
  1177. and t.owe_amount > 0
  1178. group by t.config_id,t.fee_name
  1179. order by objCount desc
  1180. </select>
  1181. <select id="queryAllPaymentCount" parameterType="Map" resultType="Map">
  1182. select t.fee_name feeName,count(distinct t.obj_id) objCount
  1183. from report_fee_month_statistics t
  1184. where t.community_id = #{communityId}
  1185. group by t.config_id,t.fee_name
  1186. order by objCount desc
  1187. </select>
  1188. <select id="queryFinishOweFee" parameterType="Map" resultType="Map">
  1189. select t.config_id configId, t.fee_id feeId,t.statistics_id statisticsId,t.fee_year feeYear,fee_month feeMonth
  1190. from report_fee_month_statistics t
  1191. inner join pay_fee pf on t.fee_id = pf.fee_id and pf.state = '2009001' and pf.community_id = #{communityId} and
  1192. pf.status_cd = '0'
  1193. where t.owe_amount > 0
  1194. and t.status_cd = '0'
  1195. and t.community_id = #{communityId}
  1196. limit 100
  1197. </select>
  1198. <!-- 查询费用配置信息 add by wuxw 2018-07-03 -->
  1199. <select id="getFeeConfigInfo" parameterType="Map" resultType="Map">
  1200. select t.fee_type_cd,t.fee_type_cd feeTypeCd,t.computing_formula,t.computing_formula
  1201. computingFormula,t.additional_amount,t.additional_amount additionalAmount,t.status_cd,t.status_cd
  1202. statusCd,t.square_price,t.square_price squarePrice,t.is_default,t.is_default isDefault,t.config_id,t.config_id
  1203. configId,t.fee_flag,t.fee_flag feeFlag,t.fee_name,t.fee_name feeName,t.start_time,t.start_time
  1204. startTime,t.end_time,t.end_time endTime,t.community_id,t.community_id communityId,t.b_id,t.b_id bId,
  1205. td1.name feeTypeCdName,td2.name feeFlagName,t.bill_type billType,t.bill_type,td3.name billTypeName,
  1206. t.payment_cd,t.payment_cycle,t.payment_cd paymentCd,t.payment_cycle paymentCycle
  1207. from pay_fee_config t,t_dict td1,t_dict td2,t_dict td3
  1208. where 1 =1
  1209. and t.fee_type_cd = td1.status_cd
  1210. and td1.table_name = 'pay_fee_config'
  1211. and td1.table_columns = 'fee_type_cd'
  1212. and t.fee_flag = td2.status_cd
  1213. and td2.table_name = 'pay_fee_config'
  1214. and td2.table_columns = 'fee_flag'
  1215. and t.bill_type = td3.status_cd
  1216. and td3.table_name = 'pay_fee_config'
  1217. and td3.table_columns = 'bill_type'
  1218. and t.is_default = 'F'
  1219. and t.status_cd = '0'
  1220. <if test="feeTypeCd !=null and feeTypeCd != ''">
  1221. and t.fee_type_cd= #{feeTypeCd}
  1222. </if>
  1223. <if test="computingFormula !=null and computingFormula != ''">
  1224. and t.computing_formula= #{computingFormula}
  1225. </if>
  1226. <if test="additionalAmount !=null and additionalAmount != ''">
  1227. and t.additional_amount= #{additionalAmount}
  1228. </if>
  1229. <if test="squarePrice !=null and squarePrice != ''">
  1230. and t.square_price= #{squarePrice}
  1231. </if>
  1232. <if test="configId !=null and configId != ''">
  1233. and t.config_id= #{configId}
  1234. </if>
  1235. <if test="feeFlag !=null and feeFlag != ''">
  1236. and t.fee_flag= #{feeFlag}
  1237. </if>
  1238. <if test="feeName !=null and feeName != ''">
  1239. and t.fee_name like '%${feeName}%'
  1240. </if>
  1241. <if test="startTime !=null ">
  1242. and t.start_time= #{startTime}
  1243. </if>
  1244. <if test="endTime !=null ">
  1245. and t.end_time= #{endTime}
  1246. </if>
  1247. <if test="valid !=null and valid == 1">
  1248. and t.end_time &gt; now()
  1249. </if>
  1250. <if test="curTime !=null ">
  1251. and t.end_time &gt; #{curTime}
  1252. and t.start_time &lt; #{curTime}
  1253. </if>
  1254. <if test="communityId !=null and communityId != ''">
  1255. and t.community_id= #{communityId}
  1256. </if>
  1257. <if test="bId !=null and bId != ''">
  1258. and t.b_id= #{bId}
  1259. </if>
  1260. <if test="paymentCd !=null and paymentCd != ''">
  1261. and t.payment_cd= #{paymentCd}
  1262. </if>
  1263. <if test="paymentCycle !=null and paymentCycle != ''">
  1264. and t.payment_cycle= #{paymentCycle}
  1265. </if>
  1266. <if test="billType !=null and billType != ''">
  1267. and t.bill_type= #{billType}
  1268. </if>
  1269. order by t.create_time desc
  1270. <if test="page != -1 and page != null ">
  1271. limit #{page}, #{row}
  1272. </if>
  1273. </select>
  1274. </mapper>