ReportFeeServiceDaoImplMapper.xml 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  3. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  4. <mapper namespace="reportFeeServiceDaoImpl">
  5. <!-- 查询实收金额 -->
  6. <select id="getFeeReceivedAmount" parameterType="com.java110.dto.report.ReportFeeDetailDto" resultType="Map">
  7. select SUM(t.received_amount) receivedAmount
  8. from pay_fee_detail t
  9. <if test="configId != null and configId != ''">
  10. inner join pay_fee pf on t.fee_id = pf.fee_id and pf.status_cd = '0'
  11. </if>
  12. where 1=1
  13. <if test="configId != null and configId != ''">
  14. and pf.config_id = #{configId}
  15. and pf.payer_obj_id = #{payerObjId}
  16. </if>
  17. <if test="feeId !=null and feeId != ''">
  18. and t.fee_id = #{feeId}
  19. </if>
  20. <if test="startTime != null">
  21. and t.create_time &gt; #{startTime}
  22. </if>
  23. and t.status_cd = '0'
  24. <if test="endTime != null">
  25. and t.create_time &lt; #{endTime}
  26. </if>
  27. <if test="curStartYear != null and curStartYear != ''">
  28. and DATE_FORMAT(t.start_time,'%Y') = #{curStartYear}
  29. </if>
  30. <if test="curEndYear != null and curEndYear != ''">
  31. and DATE_FORMAT(DATE_SUB(t.end_time,INTERVAL 1 DAY),'%Y') = #{curEndYear}
  32. </if>
  33. </select>
  34. <!-- 查询房屋个数 add by wuxw 2018-07-03 -->
  35. <select id="getFeeCount" parameterType="com.java110.dto.report.ReportFeeDto" resultType="Map">
  36. select count(1) count
  37. from pay_fee t
  38. where t.status_cd = '0'
  39. <if test="payerObjId !=null and payerObjId != ''">
  40. and t.payer_obj_id = #{payerObjId}
  41. </if>
  42. <if test="payerObjType !=null and payerObjType != ''">
  43. and t.payer_obj_type= #{payerObjType}
  44. </if>
  45. </select>
  46. <!-- 查询 费用 -->
  47. <select id="getFees" parameterType="Map" resultType="Map">
  48. select pfc.fee_name feeName,pfc.start_time configStartTime,pfc.end_time configEndTime,pfc.config_id
  49. configId,pfc.fee_type_cd feeTypeCd,
  50. pfc.additional_amount additionalAmount,pfc.bill_type billType,pfc.computing_formula
  51. computingFormula,pfc.computing_formula_text computingFormulaText,
  52. pfc.payment_cd paymentCd,
  53. pfc.payment_cycle paymentCycle,pfc.square_price squarePrice,pfc.fee_flag feeFlag,t.payer_obj_id
  54. payerObjId,t.payer_obj_type payerObjType,
  55. t.amount,t.create_time createTime,t.end_time endTime,t.fee_id feeId,t.income_obj_id incomeObjId,t.start_time
  56. startTime,t.state,
  57. br.room_id roomId,br.room_num roomNum,oc.car_num carNum,ss.store_id storeId,ss.`name` storeName,ss.store_type_cd
  58. storeTypeCd,
  59. t.community_id communityId,pfa.value importFeeName,ifd.end_time importFeeEndTime,mw.cur_degrees
  60. curDegrees,mw.pre_degrees preDegrees,
  61. mw.pre_reading_time preReadingTime,mw.cur_reading_time curReadingTime,pfa1.`value` deadlineTime,mw.price
  62. mwPrice,
  63. pfa2.`value` ownerTel, pfa3.`value` ownerName,br.room_area roomArea,
  64. pfc.pay_online payOnline,pfc.scale,pfc.decimal_place decimalPlace,pfc.units,br.room_rent roomRent,pfc.prepayment_period prepaymentPeriod
  65. from pay_fee t
  66. INNER JOIN pay_fee_config pfc on t.config_id = pfc.config_id and pfc.status_cd = '0'
  67. left join building_room br on t.payer_obj_id = br.room_id and t.payer_obj_type = '3333' and br.status_cd = '0'
  68. left join owner_car oc on t.payer_obj_id = oc.car_id and t.payer_obj_type = '6666' and oc.status_cd = '0' and
  69. oc.car_type_cd='1001'
  70. left join s_store ss on t.income_obj_id = ss.store_id and ss.status_cd = '0'
  71. LEFT JOIN pay_fee_attrs pfa on t.fee_id = pfa.fee_id and pfa.spec_cd = '390002' and pfa.status_cd = '0'
  72. LEFT JOIN pay_fee_attrs pfa1 on t.fee_id = pfa1.fee_id and pfa1.spec_cd = '390010' and pfa1.status_cd = '0'
  73. LEFT JOIN pay_fee_attrs pfa2 on t.fee_id = pfa2.fee_id and pfa2.spec_cd = '390009' and pfa2.status_cd = '0'
  74. LEFT JOIN pay_fee_attrs pfa3 on t.fee_id = pfa3.fee_id and pfa3.spec_cd = '390008' and pfa3.status_cd = '0'
  75. left join import_fee_detail ifd on t.fee_id = ifd.fee_id and ifd.status_cd = '0' and t.fee_flag = '2006012'
  76. LEFT JOIN meter_water mw on t.fee_id = mw.fee_id and mw.status_cd = '0' and mw.community_id = t.community_id
  77. where t.status_cd = '0'
  78. <if test="state !=null and state != ''">
  79. and t.state= #{state}
  80. </if>
  81. <if test="payerObjId !=null and payerObjId != ''">
  82. and t.payer_obj_id= #{payerObjId}
  83. </if>
  84. <if test="payerObjType !=null and payerObjType != ''">
  85. and t.payer_obj_type= #{payerObjType}
  86. </if>
  87. <if test="communityId !=null and communityId != ''">
  88. and t.community_id= #{communityId}
  89. </if>
  90. <if test="configId !=null and configId != ''">
  91. and t.config_id= #{configId}
  92. </if>
  93. <if test="feeFlag !=null and feeFlag != ''">
  94. and t.fee_flag= #{feeFlag}
  95. </if>
  96. <if test="page != -1 and page != null ">
  97. limit #{page}, #{row}
  98. </if>
  99. </select>
  100. <!-- 查询费用配置信息 add by wuxw 2018-07-03 -->
  101. <select id="getFeeConfigs" parameterType="com.java110.dto.fee.FeeConfigDto"
  102. resultType="com.java110.dto.fee.FeeConfigDto">
  103. select t.fee_type_cd,t.fee_type_cd feeTypeCd,t.computing_formula,t.computing_formula
  104. computingFormula,t.additional_amount,t.additional_amount additionalAmount,t.status_cd,t.status_cd
  105. statusCd,t.square_price,t.square_price squarePrice,t.is_default,t.is_default isDefault,t.config_id,t.config_id
  106. configId,t.fee_flag,t.fee_flag feeFlag,t.fee_name,t.fee_name feeName,t.start_time,t.start_time
  107. startTime,t.end_time,t.end_time endTime,t.community_id,t.community_id communityId,
  108. td1.name feeTypeCdName,td2.name feeFlagName,t.bill_type billType,t.bill_type,td3.name billTypeName,
  109. t.payment_cd,t.payment_cycle,t.payment_cd paymentCd,t.payment_cycle paymentCycle,
  110. t.computing_formula_text,t.computing_formula_text computingFormulaText,
  111. t.pay_online payOnline,t.scale,t.decimal_place decimalPlace,t.units
  112. from pay_fee_config t,t_dict td1,t_dict td2,t_dict td3
  113. where 1 =1
  114. and t.fee_type_cd = td1.status_cd
  115. and td1.table_name = 'pay_fee_config'
  116. and td1.table_columns = 'fee_type_cd'
  117. and t.fee_flag = td2.status_cd
  118. and td2.table_name = 'pay_fee_config'
  119. and td2.table_columns = 'fee_flag'
  120. and t.bill_type = td3.status_cd
  121. and td3.table_name = 'pay_fee_config'
  122. and td3.table_columns = 'bill_type'
  123. <if test="feeTypeCd !=null and feeTypeCd != ''">
  124. and t.fee_type_cd= #{feeTypeCd}
  125. </if>
  126. <if test="computingFormula !=null and computingFormula != ''">
  127. and t.computing_formula= #{computingFormula}
  128. </if>
  129. <if test="additionalAmount !=null and additionalAmount != ''">
  130. and t.additional_amount= #{additionalAmount}
  131. </if>
  132. <if test="statusCd !=null and statusCd != ''">
  133. and t.status_cd= #{statusCd}
  134. </if>
  135. <if test="squarePrice !=null and squarePrice != ''">
  136. and t.square_price= #{squarePrice}
  137. </if>
  138. <if test="isDefault !=null and isDefault != ''">
  139. and t.is_default= #{isDefault}
  140. </if>
  141. <if test="configId !=null and configId != ''">
  142. and t.config_id= #{configId}
  143. </if>
  144. <if test="feeFlag !=null and feeFlag != ''">
  145. and t.fee_flag= #{feeFlag}
  146. </if>
  147. <if test="feeName !=null and feeName != ''">
  148. and t.fee_name like '%${feeName}%'
  149. </if>
  150. <if test="startTime !=null ">
  151. and t.start_time= #{startTime}
  152. </if>
  153. <if test="endTime !=null ">
  154. and t.end_time= #{endTime}
  155. </if>
  156. <if test="valid !=null and valid == 1">
  157. and t.end_time &gt; now()
  158. </if>
  159. <if test="curTime !=null ">
  160. and t.end_time &gt; #{curTime}
  161. and t.start_time &lt; #{curTime}
  162. </if>
  163. <if test="communityId !=null and communityId != ''">
  164. and t.community_id= #{communityId}
  165. </if>
  166. <if test="paymentCd !=null and paymentCd != ''">
  167. and t.payment_cd= #{paymentCd}
  168. </if>
  169. <if test="paymentCycle !=null and paymentCycle != ''">
  170. and t.payment_cycle= #{paymentCycle}
  171. </if>
  172. <if test="billType !=null and billType != ''">
  173. and t.bill_type= #{billType}
  174. </if>
  175. order by t.create_time desc
  176. <if test="page != -1 and page != null ">
  177. limit #{page}, #{row}
  178. </if>
  179. </select>
  180. </mapper>