PayFeeDetailMonthServiceDaoImplMapper.xml 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551
  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="payFeeDetailMonthServiceDaoImpl">
  6. <!-- 保存月缴费表信息 add by wuxw 2018-07-03 -->
  7. <insert id="savePayFeeDetailMonthInfo" parameterType="Map">
  8. insert into pay_fee_detail_month(
  9. detail_month,detail_year,detail_id,receivable_amount,discount_amount,remark,received_amount,community_id,fee_id,month_id,
  10. obj_name,obj_id,owner_name,owner_id,link,state,pay_fee_time,cur_month_time,
  11. fee_name,config_id
  12. ) values (
  13. #{detailMonth},#{detailYear},#{detailId},#{receivableAmount},#{discountAmount},#{remark},#{receivedAmount},#{communityId},#{feeId},#{monthId},
  14. #{objName},#{objId},#{ownerName},#{ownerId},#{link},#{state},#{payFeeTime},#{curMonthTime},
  15. #{feeName},#{configId}
  16. )
  17. </insert>
  18. <!-- 保存月缴费表信息 add by wuxw 2018-07-03 -->
  19. <insert id="savePayFeeDetailMonthInfos" parameterType="Map">
  20. insert into pay_fee_detail_month(
  21. detail_month,detail_year,detail_id,receivable_amount,discount_amount,remark,received_amount,community_id,fee_id,month_id,
  22. obj_name,obj_id,owner_name,owner_id,link,state,pay_fee_time,cur_month_time,
  23. fee_name,config_id,deadline_time
  24. ) values
  25. <foreach collection="payFeeDetailMonthPos" item="item" index="index" separator=",">
  26. (
  27. #{item.detailMonth},#{item.detailYear},#{item.detailId},#{item.receivableAmount},#{item.discountAmount},
  28. #{item.remark},#{item.receivedAmount},#{item.communityId},#{item.feeId},#{item.monthId},
  29. #{item.objName},#{item.objId},#{item.ownerName},#{item.ownerId},#{item.link},#{item.state},#{item.payFeeTime},#{item.curMonthTime},
  30. #{item.feeName},#{item.configId},#{item.deadlineTime}
  31. )
  32. </foreach>
  33. </insert>
  34. <!-- 查询月缴费表信息 add by wuxw 2018-07-03 -->
  35. <select id="getPayFeeDetailMonthInfo" parameterType="Map" resultType="Map">
  36. select t.detail_month,t.detail_month detailMonth,t.detail_year,t.detail_year detailYear,t.detail_id,t.detail_id
  37. detailId,t.receivable_amount,t.receivable_amount receivableAmount,t.discount_amount,t.discount_amount
  38. discountAmount,t.remark,t.status_cd,t.status_cd statusCd,t.received_amount,t.received_amount
  39. receivedAmount,t.community_id,t.community_id communityId,t.fee_id,t.fee_id feeId,t.month_id,t.month_id monthId,
  40. t.obj_name objName,t.obj_id objId,t.owner_name ownerName,t.owner_id ownerId,t.link,t.state,t.pay_fee_time
  41. payFeeTime,
  42. t.cur_month_time curMonthTime,t.deadline_time deadlineTime,pf.fee_flag feeFlag,pf.end_time endTime
  43. from pay_fee_detail_month t
  44. left join pay_fee pf on t.fee_id = pf.fee_id and pf.status_cd = '0'
  45. where 1 =1
  46. <if test="detailMonth !=null and detailMonth != ''">
  47. and t.detail_month= #{detailMonth}
  48. </if>
  49. <if test="detailYear !=null and detailYear != ''">
  50. and t.detail_year= #{detailYear}
  51. </if>
  52. <if test="detailId !=null and detailId != ''">
  53. and t.detail_id= #{detailId}
  54. </if>
  55. <if test="receivableAmount !=null and receivableAmount != ''">
  56. and t.receivable_amount= #{receivableAmount}
  57. </if>
  58. <if test="discountAmount !=null and discountAmount != ''">
  59. and t.discount_amount= #{discountAmount}
  60. </if>
  61. <if test="remark !=null and remark != ''">
  62. and t.remark= #{remark}
  63. </if>
  64. <if test="statusCd !=null and statusCd != ''">
  65. and t.status_cd= #{statusCd}
  66. </if>
  67. <if test="receivedAmount !=null and receivedAmount != ''">
  68. and t.received_amount= #{receivedAmount}
  69. </if>
  70. <if test="communityId !=null and communityId != ''">
  71. and t.community_id= #{communityId}
  72. </if>
  73. <if test="feeId !=null and feeId != ''">
  74. and t.fee_id= #{feeId}
  75. </if>
  76. <if test="monthId !=null and monthId != ''">
  77. and t.month_id= #{monthId}
  78. </if>
  79. <if test="monthIds !=null ">
  80. and t.month_id in
  81. <foreach collection="monthIds" item="item" open="(" close=")" separator=",">
  82. #{item}
  83. </foreach>
  84. </if>
  85. <if test="objName !=null and objName != ''">
  86. and t.obj_name= #{objName}
  87. </if>
  88. <if test="objId !=null and objId != ''">
  89. and t.obj_id= #{objId}
  90. </if>
  91. <if test="ownerName !=null and ownerName != ''">
  92. and t.owner_name= #{ownerName}
  93. </if>
  94. <if test="ownerId !=null and ownerId != ''">
  95. and t.owner_id= #{ownerId}
  96. </if>
  97. <if test="state !=null and state != ''">
  98. and t.state= #{state}
  99. </if>
  100. <if test="payFeeTime !=null and payFeeTime != ''">
  101. and t.pay_fee_time= #{payFeeTime}
  102. </if>
  103. order by t.create_time desc
  104. <if test="page != -1 and page != null ">
  105. limit #{page}, #{row}
  106. </if>
  107. </select>
  108. <!-- 修改月缴费表信息 add by wuxw 2018-07-03 -->
  109. <update id="updatePayFeeDetailMonthInfo" parameterType="Map">
  110. update pay_fee_detail_month t set t.status_cd = #{statusCd}
  111. <if test="newBId != null and newBId != ''">
  112. ,t.b_id = #{newBId}
  113. </if>
  114. <if test="detailMonth !=null and detailMonth != ''">
  115. , t.detail_month= #{detailMonth}
  116. </if>
  117. <if test="detailYear !=null and detailYear != ''">
  118. , t.detail_year= #{detailYear}
  119. </if>
  120. <if test="receivableAmount !=null and receivableAmount != ''">
  121. , t.receivable_amount= #{receivableAmount}
  122. </if>
  123. <if test="discountAmount !=null and discountAmount != ''">
  124. , t.discount_amount= #{discountAmount}
  125. </if>
  126. <if test="remark !=null and remark != ''">
  127. , t.remark= #{remark}
  128. </if>
  129. <if test="receivedAmount !=null and receivedAmount != ''">
  130. , t.received_amount= #{receivedAmount}
  131. </if>
  132. <if test="objName !=null and objName != ''">
  133. , t.obj_name= #{objName}
  134. </if>
  135. <if test="objId !=null and objId != ''">
  136. , t.obj_id= #{objId}
  137. </if>
  138. <if test="ownerName !=null and ownerName != ''">
  139. , t.owner_name= #{ownerName}
  140. </if>
  141. <if test="ownerId !=null and ownerId != ''">
  142. , t.owner_id= #{ownerId}
  143. </if>
  144. <if test="state !=null and state != ''">
  145. , t.state= #{state}
  146. </if>
  147. <if test="payFeeTime !=null and payFeeTime != ''">
  148. , t.pay_fee_time= #{payFeeTime}
  149. </if>
  150. where 1=1
  151. <if test="monthId !=null and monthId != ''">
  152. and t.month_id= #{monthId}
  153. </if>
  154. <if test="communityId !=null and communityId != ''">
  155. and t.community_id= #{communityId}
  156. </if>
  157. <if test="feeId !=null and feeId != ''">
  158. and t.fee_id= #{feeId}
  159. </if>
  160. <if test="detailId !=null and detailId != ''">
  161. and t.detail_id= #{detailId}
  162. </if>
  163. <if test="curMonthStartTime !=null and curMonthStartTime != ''">
  164. and t.cur_month_time &gt;= #{curMonthStartTime}
  165. and t.cur_month_time &lt;= #{curMonthEndTime}
  166. </if>
  167. </update>
  168. <!-- 删除离散数据 -->
  169. <delete id="deletePayFeeDetailMonthInfo" parameterType="Map">
  170. delete from pay_fee_detail_month
  171. where 1=1
  172. and community_id= #{communityId}
  173. <if test="monthId !=null and monthId != ''">
  174. and month_id= #{monthId}
  175. </if>
  176. <if test="feeId !=null and feeId != ''">
  177. and fee_id= #{feeId}
  178. </if>
  179. <if test="detailId !=null and detailId != ''">
  180. and detail_id= #{detailId}
  181. </if>
  182. </delete>
  183. <!-- 查询月缴费表数量 add by wuxw 2018-07-03 -->
  184. <select id="queryPayFeeDetailMonthsCount" parameterType="Map" resultType="Map">
  185. select count(1) count
  186. from pay_fee_detail_month t
  187. where 1 =1
  188. <if test="detailMonth !=null and detailMonth != ''">
  189. and t.detail_month= #{detailMonth}
  190. </if>
  191. <if test="detailYear !=null and detailYear != ''">
  192. and t.detail_year= #{detailYear}
  193. </if>
  194. <if test="detailId !=null and detailId != ''">
  195. and t.detail_id= #{detailId}
  196. </if>
  197. <if test="receivableAmount !=null and receivableAmount != ''">
  198. and t.receivable_amount= #{receivableAmount}
  199. </if>
  200. <if test="discountAmount !=null and discountAmount != ''">
  201. and t.discount_amount= #{discountAmount}
  202. </if>
  203. <if test="remark !=null and remark != ''">
  204. and t.remark= #{remark}
  205. </if>
  206. <if test="statusCd !=null and statusCd != ''">
  207. and t.status_cd= #{statusCd}
  208. </if>
  209. <if test="receivedAmount !=null and receivedAmount != ''">
  210. and t.received_amount= #{receivedAmount}
  211. </if>
  212. <if test="communityId !=null and communityId != ''">
  213. and t.community_id= #{communityId}
  214. </if>
  215. <if test="feeId !=null and feeId != ''">
  216. and t.fee_id= #{feeId}
  217. </if>
  218. <if test="monthId !=null and monthId != ''">
  219. and t.month_id= #{monthId}
  220. </if>
  221. <if test="monthIds !=null ">
  222. and t.month_id in
  223. <foreach collection="monthIds" item="item" open="(" close=")" separator=",">
  224. #{item}
  225. </foreach>
  226. </if>
  227. <if test="objName !=null and objName != ''">
  228. and t.obj_name= #{objName}
  229. </if>
  230. <if test="objId !=null and objId != ''">
  231. and t.obj_id= #{objId}
  232. </if>
  233. <if test="ownerName !=null and ownerName != ''">
  234. and t.owner_name= #{ownerName}
  235. </if>
  236. <if test="ownerId !=null and ownerId != ''">
  237. and t.owner_id= #{ownerId}
  238. </if>
  239. <if test="state !=null and state != ''">
  240. and t.state= #{state}
  241. </if>
  242. <if test="payFeeTime !=null and payFeeTime != ''">
  243. and t.pay_fee_time= #{payFeeTime}
  244. </if>
  245. </select>
  246. <select id="queryPayFeeDetailMaxMonths" parameterType="Map" resultType="Map">
  247. select t.detail_month,t.detail_month detailMonth,t.detail_year,t.detail_year detailYear,t.detail_id,t.detail_id
  248. detailId,t.receivable_amount,t.receivable_amount receivableAmount,t.discount_amount,t.discount_amount
  249. discountAmount,t.remark,t.status_cd,t.status_cd statusCd,t.received_amount,t.received_amount
  250. receivedAmount,t.community_id,t.community_id communityId,t.fee_id,t.fee_id feeId,t.month_id,t.month_id monthId,
  251. t.obj_name objName,t.obj_id objId,t.owner_name ownerName,t.owner_id ownerId,t.link,t.state,t.pay_fee_time
  252. payFeeTime,
  253. t.cur_month_time curMonthTime
  254. from pay_fee_detail_month t
  255. where 1 =1
  256. <if test="detailMonth !=null and detailMonth != ''">
  257. and t.detail_month= #{detailMonth}
  258. </if>
  259. <if test="detailYear !=null and detailYear != ''">
  260. and t.detail_year= #{detailYear}
  261. </if>
  262. <if test="detailId !=null and detailId != ''">
  263. and t.detail_id= #{detailId}
  264. </if>
  265. <if test="receivableAmount !=null and receivableAmount != ''">
  266. and t.receivable_amount= #{receivableAmount}
  267. </if>
  268. <if test="discountAmount !=null and discountAmount != ''">
  269. and t.discount_amount= #{discountAmount}
  270. </if>
  271. <if test="remark !=null and remark != ''">
  272. and t.remark= #{remark}
  273. </if>
  274. <if test="statusCd !=null and statusCd != ''">
  275. and t.status_cd= #{statusCd}
  276. </if>
  277. <if test="receivedAmount !=null and receivedAmount != ''">
  278. and t.received_amount= #{receivedAmount}
  279. </if>
  280. <if test="communityId !=null and communityId != ''">
  281. and t.community_id= #{communityId}
  282. </if>
  283. <if test="feeId !=null and feeId != ''">
  284. and t.fee_id= #{feeId}
  285. </if>
  286. <if test="monthId !=null and monthId != ''">
  287. and t.month_id= #{monthId}
  288. </if>
  289. <if test="objName !=null and objName != ''">
  290. and t.obj_name= #{objName}
  291. </if>
  292. <if test="objId !=null and objId != ''">
  293. and t.obj_id= #{objId}
  294. </if>
  295. <if test="ownerName !=null and ownerName != ''">
  296. and t.owner_name= #{ownerName}
  297. </if>
  298. <if test="ownerId !=null and ownerId != ''">
  299. and t.owner_id= #{ownerId}
  300. </if>
  301. <if test="state !=null and state != ''">
  302. and t.state= #{state}
  303. </if>
  304. <if test="payFeeTime !=null and payFeeTime != ''">
  305. and t.pay_fee_time= #{payFeeTime}
  306. </if>
  307. order by t.detail_year desc,t.detail_month desc
  308. <if test="page != -1 and page != null ">
  309. limit #{page}, #{row}
  310. </if>
  311. </select>
  312. <!-- 查询需要离散的缴费记录 -->
  313. <select id="getWaitDispersedFeeDetail" parameterType="Map" resultType="Map">
  314. select t.prime_rate,t.prime_rate primeRate,
  315. t.detail_id,t.detail_id detailId,
  316. t.receivable_amount,t.receivable_amount receivableAmount,
  317. t.cycles,t.remark,t.status_cd,t.status_cd statusCd,t.received_amount,t.received_amount receivedAmount,
  318. t.community_id,t.community_id communityId,t.b_id,t.b_id bId,t.fee_id,t.fee_id feeId ,t.create_time createTime,
  319. t.state,d.name stateName,t.start_time,t.end_time,t.start_time startTime,t.end_time endTime,pfa.`value`
  320. importFeeName,pfc.fee_name feeName,t.payable_amount,t.payable_amount payableAmount,
  321. mw.cur_degrees curDegrees,mw.pre_degrees preDegrees, mw.pre_reading_time preReadingTime,mw.cur_reading_time
  322. curReadingTime,t.pay_order_id payOrderId,pfc.config_id configId,td.`name` primeRateName,pfao1.`value`
  323. payerObjName,
  324. t.cashier_id cashierId,t.cashier_name cashierName
  325. from pay_fee_detail t
  326. left join pay_fee_detail_month pfdm on t.fee_id = pfdm.fee_id and pfdm.detail_id = t.detail_id and
  327. pfdm.status_cd = '0' and t.community_id = pfdm.community_id
  328. left join pay_fee_attrs pfa on t.fee_id = pfa.fee_id and pfa.spec_cd = '390002'
  329. left join pay_fee pf on t.fee_id = pf.fee_id and pf.status_cd = '0'
  330. left join pay_fee_config pfc on pf.config_id = pfc.config_id and pfc.status_cd = '0'
  331. LEFT JOIN meter_water mw on t.fee_id = mw.fee_id and mw.status_cd = '0' and mw.community_id = t.community_id
  332. left join pay_fee_attrs pfao1 on pfao1.fee_id = t.fee_id and pfao1.spec_cd = '390012' and pfao1.status_cd = '0'
  333. left join t_dict d on t.state = d.status_cd and d.table_name = 'pay_fee_detail' and d.table_columns = 'state'
  334. left join t_dict td on t.prime_rate = td.status_cd and td.table_name = 'pay_fee_detail' and td.table_columns =
  335. 'prime_rate'
  336. where t.status_cd = '0'
  337. and t.state in ('1000','1400')
  338. and t.community_id = #{communityId}
  339. and t.fee_id = #{feeId}
  340. and pfdm.detail_id is null
  341. </select>
  342. <!-- 查询月数据 -->
  343. <select id="queryPagePayFeeDetailMonths" parameterType="Map" resultType="Map">
  344. select t.detail_month detailMonth,t.detail_year detailYear,t.detail_id
  345. detailId,t.receivable_amount receivableAmount,t.discount_amount discountAmount,t.remark,t.received_amount receivedAmount,
  346. t.community_id communityId,t.fee_id feeId,t.month_id monthId,
  347. t.obj_name objName,t.obj_id objId,t.owner_name ownerName,t.owner_id ownerId,t.link,t.state,t.pay_fee_time
  348. payFeeTime,t.cur_month_time curMonthTime,pfc.square_price squarePrice,pfc.additional_amount
  349. additionalAmount,pfc.fee_flag,pfc.fee_flag feeFlag,
  350. pfc.fee_name feeName,td1.name feeTypeCdName,td3.name feeFlagName,pfc.computing_formula
  351. computingFormula,pfc.computing_formula_text computingFormulaText,
  352. pfc.bill_type billType,pf.payer_obj_type payerObjType,pfc.is_default isDefault,pfc.start_time
  353. configStartTime,pfc.end_time configEndTime,pfc.payment_cd paymentCd,pfc.payment_cycle paymentCycle,td4.name
  354. billTypeName,pfa.value importFeeName,mw.cur_degrees curDegrees,mw.pre_degrees
  355. preDegrees,
  356. mw.pre_reading_time preReadingTime,mw.cur_reading_time curReadingTime,pfa1.`value` deadlineTime,pfa1.`value` maxEndTime,mw.price
  357. mwPrice,
  358. pfa2.`value` ownerName,pf.batch_id batchId,
  359. pfc.pay_online payOnline,pfc.scale,pfc.decimal_place decimalPlace,pfc.units
  360. from pay_fee_detail_month t
  361. inner join pay_fee pf on t.fee_id = pf.fee_id and pf.status_cd = '0'
  362. INNER join pay_fee_config pfc on t.config_id = pfc.config_id and
  363. pfc.status_cd = '0'
  364. left join t_dict td1 on pfc.fee_type_cd = td1.status_cd and td1.table_name = 'pay_fee_config' and
  365. td1.table_columns = 'fee_type_cd'
  366. left join t_dict td3 on pfc.fee_flag = td3.status_cd and td3.table_name = 'pay_fee' and td3.table_columns =
  367. 'fee_flag'
  368. left join t_dict td4 on pfc.bill_type = td4.status_cd and td4.table_name = 'pay_fee_config' and
  369. td4.table_columns = 'bill_type'
  370. LEFT JOIN pay_fee_attrs pfa on t.fee_id = pfa.fee_id and pfa.spec_cd = '390002' and pfa.status_cd = '0'
  371. LEFT JOIN pay_fee_attrs pfa1 on t.fee_id = pfa1.fee_id and pfa1.spec_cd = '390010' and pfa1.status_cd = '0'
  372. LEFT JOIN pay_fee_attrs pfa2 on t.fee_id = pfa2.fee_id and pfa2.spec_cd = '390008' and pfa2.status_cd = '0'
  373. LEFT JOIN meter_water mw on t.fee_id = mw.fee_id and mw.status_cd = '0' and mw.community_id = t.community_id
  374. <if test="ownerId != null and ownerId != ''">
  375. LEFT JOIN pay_fee_attrs pfao on t.fee_id = pfao.fee_id and pfao.spec_cd = '390007' and pfao.status_cd = '0'
  376. </if>
  377. where 1 =1
  378. <if test="ownerId !=null and ownerId != ''">
  379. and pfao.value= #{ownerId}
  380. </if>
  381. <if test="detailMonth !=null and detailMonth != ''">
  382. and t.detail_month= #{detailMonth}
  383. </if>
  384. <if test="feeTypeCd !=null and feeTypeCd != ''">
  385. and pf.fee_type_cd= #{feeTypeCd}
  386. </if>
  387. <if test="feeTypeCds != null ">
  388. and pf.fee_type_cd in
  389. <foreach collection="feeTypeCds" item="item" open="(" close=")" separator=",">
  390. #{item}
  391. </foreach>
  392. </if>
  393. <if test="detailYear !=null and detailYear != ''">
  394. and t.detail_year= #{detailYear}
  395. </if>
  396. <if test="detailId !=null and detailId != ''">
  397. and t.detail_id= #{detailId}
  398. </if>
  399. <if test="receivableAmount !=null and receivableAmount != ''">
  400. and t.receivable_amount= #{receivableAmount}
  401. </if>
  402. <if test="discountAmount !=null and discountAmount != ''">
  403. and t.discount_amount= #{discountAmount}
  404. </if>
  405. <if test="remark !=null and remark != ''">
  406. and t.remark= #{remark}
  407. </if>
  408. <if test="statusCd !=null and statusCd != ''">
  409. and t.status_cd= #{statusCd}
  410. </if>
  411. <if test="receivedAmount !=null and receivedAmount != ''">
  412. and t.received_amount= #{receivedAmount}
  413. </if>
  414. <if test="communityId !=null and communityId != ''">
  415. and t.community_id= #{communityId}
  416. </if>
  417. <if test="feeId !=null and feeId != ''">
  418. and t.fee_id= #{feeId}
  419. </if>
  420. <if test="monthId !=null and monthId != ''">
  421. and t.month_id= #{monthId}
  422. </if>
  423. <if test="monthIds !=null ">
  424. and t.month_id in
  425. <foreach collection="monthIds" item="item" open="(" close=")" separator=",">
  426. #{item}
  427. </foreach>
  428. </if>
  429. <if test="objName !=null and objName != ''">
  430. and t.obj_name= #{objName}
  431. </if>
  432. <if test="objId !=null and objId != ''">
  433. and t.obj_id= #{objId}
  434. </if>
  435. <if test="ownerName !=null and ownerName != ''">
  436. and t.owner_name= #{ownerName}
  437. </if>
  438. <if test="ownerId !=null and ownerId != ''">
  439. and t.owner_id= #{ownerId}
  440. </if>
  441. <if test="state !=null and state != ''">
  442. and t.state= #{state}
  443. </if>
  444. <if test="payFeeTime !=null and payFeeTime != ''">
  445. and t.pay_fee_time= #{payFeeTime}
  446. </if>
  447. order by t.detail_year,t.detail_month
  448. <if test="page != -1 and page != null ">
  449. limit #{page}, #{row}
  450. </if>
  451. </select>
  452. <!-- 查询月缴费表数量 add by wuxw 2018-07-03 -->
  453. <select id="queryPagePayFeeDetailMonthsCount" parameterType="Map" resultType="Map">
  454. select count(1) count
  455. from pay_fee_detail_month t
  456. inner join pay_fee pf on t.fee_id = pf.fee_id and pf.status_cd = '0'
  457. INNER join pay_fee_config pfc on t.config_id = pfc.config_id and pfc.status_cd = '0'
  458. left join t_dict td1 on pfc.fee_type_cd = td1.status_cd and td1.table_name = 'pay_fee_config' and
  459. td1.table_columns = 'fee_type_cd'
  460. left join t_dict td3 on pfc.fee_flag = td3.status_cd and td3.table_name = 'pay_fee' and td3.table_columns =
  461. 'fee_flag'
  462. left join t_dict td4 on pfc.bill_type = td4.status_cd and td4.table_name = 'pay_fee_config' and
  463. td4.table_columns = 'bill_type'
  464. LEFT JOIN pay_fee_attrs pfa on t.fee_id = pfa.fee_id and pfa.spec_cd = '390002' and pfa.status_cd = '0'
  465. LEFT JOIN pay_fee_attrs pfa1 on t.fee_id = pfa1.fee_id and pfa1.spec_cd = '390010' and pfa1.status_cd = '0'
  466. LEFT JOIN pay_fee_attrs pfa2 on t.fee_id = pfa2.fee_id and pfa2.spec_cd = '390008' and pfa2.status_cd = '0'
  467. LEFT JOIN meter_water mw on t.fee_id = mw.fee_id and mw.status_cd = '0' and mw.community_id = t.community_id
  468. <if test="ownerId != null and ownerId != ''">
  469. LEFT JOIN pay_fee_attrs pfao on t.fee_id = pfao.fee_id and pfao.spec_cd = '390007' and pfao.status_cd = '0'
  470. </if>
  471. where 1 =1
  472. <if test="ownerId !=null and ownerId != ''">
  473. and pfao.value= #{ownerId}
  474. </if>
  475. <if test="detailMonth !=null and detailMonth != ''">
  476. and t.detail_month= #{detailMonth}
  477. </if>
  478. <if test="feeTypeCd !=null and feeTypeCd != ''">
  479. and pf.fee_type_cd= #{feeTypeCd}
  480. </if>
  481. <if test="feeTypeCds != null ">
  482. and pf.fee_type_cd in
  483. <foreach collection="feeTypeCds" item="item" open="(" close=")" separator=",">
  484. #{item}
  485. </foreach>
  486. </if>
  487. <if test="detailYear !=null and detailYear != ''">
  488. and t.detail_year= #{detailYear}
  489. </if>
  490. <if test="detailId !=null and detailId != ''">
  491. and t.detail_id= #{detailId}
  492. </if>
  493. <if test="receivableAmount !=null and receivableAmount != ''">
  494. and t.receivable_amount= #{receivableAmount}
  495. </if>
  496. <if test="discountAmount !=null and discountAmount != ''">
  497. and t.discount_amount= #{discountAmount}
  498. </if>
  499. <if test="remark !=null and remark != ''">
  500. and t.remark= #{remark}
  501. </if>
  502. <if test="statusCd !=null and statusCd != ''">
  503. and t.status_cd= #{statusCd}
  504. </if>
  505. <if test="receivedAmount !=null and receivedAmount != ''">
  506. and t.received_amount= #{receivedAmount}
  507. </if>
  508. <if test="communityId !=null and communityId != ''">
  509. and t.community_id= #{communityId}
  510. </if>
  511. <if test="feeId !=null and feeId != ''">
  512. and t.fee_id= #{feeId}
  513. </if>
  514. <if test="monthId !=null and monthId != ''">
  515. and t.month_id= #{monthId}
  516. </if>
  517. <if test="objName !=null and objName != ''">
  518. and t.obj_name= #{objName}
  519. </if>
  520. <if test="objId !=null and objId != ''">
  521. and t.obj_id= #{objId}
  522. </if>
  523. <if test="ownerName !=null and ownerName != ''">
  524. and t.owner_name= #{ownerName}
  525. </if>
  526. <if test="ownerId !=null and ownerId != ''">
  527. and t.owner_id= #{ownerId}
  528. </if>
  529. <if test="state !=null and state != ''">
  530. and t.state= #{state}
  531. </if>
  532. <if test="payFeeTime !=null and payFeeTime != ''">
  533. and t.pay_fee_time= #{payFeeTime}
  534. </if>
  535. </select>
  536. </mapper>