ReportFeeServiceDaoImplMapper.xml 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  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="reportFeeServiceDaoImpl">
  6. <!-- 查询实收金额 -->
  7. <select id="getFeeReceivedAmount" parameterType="com.java110.dto.report.ReportFeeDetailDto" resultType="Map">
  8. select SUM(t.received_amount) receivedAmount
  9. from pay_fee_detail t
  10. <if test="configId != null and configId != ''">
  11. inner join pay_fee pf on t.fee_id = pf.fee_id and pf.status_cd = '0'
  12. </if>
  13. where 1=1
  14. <if test="configId != null and configId != ''">
  15. and pf.config_id = #{configId}
  16. and pf.payer_obj_id = #{payerObjId}
  17. </if>
  18. <if test="feeId !=null and feeId != ''">
  19. and t.fee_id = #{feeId}
  20. </if>
  21. <if test="startTime != null">
  22. and t.create_time &gt; #{startTime}
  23. </if>
  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="com.java110.dto.report.ReportFeeDto"
  48. resultType="com.java110.dto.report.ReportFeeDto">
  49. select pfc.fee_name feeName,pfc.start_time configStartTime,pfc.end_time configEndTime,pfc.config_id
  50. configId,pfc.fee_type_cd feeTypeCd,
  51. pfc.additional_amount additionalAmount,pfc.bill_type billType,pfc.computing_formula
  52. computingFormula,pfc.computing_formula_text computingFormulaText,
  53. pfc.payment_cd paymentCd,
  54. pfc.payment_cycle paymentCycle,pfc.square_price squarePrice,pfc.fee_flag feeFlag,t.payer_obj_id
  55. payerObjId,t.payer_obj_type payerObjType,
  56. t.amount,t.create_time createTime,t.end_time endTime,t.fee_id feeId,t.income_obj_id incomeObjId,t.start_time
  57. startTime,t.state,
  58. br.room_id roomId,br.room_num roomNum,oc.car_num carNum,ss.store_id storeId,ss.`name` storeName,ss.store_type_cd
  59. storeTypeCd,
  60. t.community_id communityId,pfa.value importFeeName,ifd.end_time importFeeEndTime,mw.cur_degrees
  61. curDegrees,mw.pre_degrees preDegrees,
  62. mw.pre_reading_time preReadingTime,mw.cur_reading_time curReadingTime,pfa1.`value` deadlineTime
  63. from pay_fee t
  64. INNER JOIN pay_fee_config pfc on t.config_id = pfc.config_id and pfc.status_cd = '0'
  65. left join building_room br on t.payer_obj_id = br.room_id and t.payer_obj_type = '3333' and br.status_cd = '0'
  66. 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
  67. oc.car_type_cd='1001'
  68. left join s_store ss on t.income_obj_id = ss.store_id and ss.status_cd = '0'
  69. LEFT JOIN pay_fee_attrs pfa on t.fee_id = pfa.fee_id and pfa.spec_cd = '390002' and pfa.status_cd = '0'
  70. LEFT JOIN pay_fee_attrs pfa1 on t.fee_id = pfa1.fee_id and pfa1.spec_cd = '390010' and pfa1.status_cd = '0'
  71. left join import_fee_detail ifd on t.fee_id = ifd.fee_id and ifd.status_cd = '0' and t.fee_flag = '2006012'
  72. LEFT JOIN meter_water mw on t.fee_id = mw.fee_id and mw.status_cd = '0' and mw.community_id = t.community_id
  73. where t.status_cd = '0'
  74. <if test="state !=null and state != ''">
  75. and t.state= #{state}
  76. </if>
  77. <if test="payerObjId !=null and payerObjId != ''">
  78. and t.payer_obj_id= #{payerObjId}
  79. </if>
  80. <if test="payerObjType !=null and payerObjType != ''">
  81. and t.payer_obj_type= #{payerObjType}
  82. </if>
  83. <if test="communityId !=null and communityId != ''">
  84. and t.community_id= #{communityId}
  85. </if>
  86. <if test="feeFlag !=null and feeFlag != ''">
  87. and t.fee_flag= #{feeFlag}
  88. </if>
  89. <if test="page != -1 and page != null ">
  90. limit #{page}, #{row}
  91. </if>
  92. </select>
  93. <!-- 查询费用配置信息 add by wuxw 2018-07-03 -->
  94. <select id="getFeeConfigs" parameterType="com.java110.dto.fee.FeeConfigDto"
  95. resultType="com.java110.dto.fee.FeeConfigDto">
  96. select t.fee_type_cd,t.fee_type_cd feeTypeCd,t.computing_formula,t.computing_formula
  97. computingFormula,t.additional_amount,t.additional_amount additionalAmount,t.status_cd,t.status_cd
  98. statusCd,t.square_price,t.square_price squarePrice,t.is_default,t.is_default isDefault,t.config_id,t.config_id
  99. configId,t.fee_flag,t.fee_flag feeFlag,t.fee_name,t.fee_name feeName,t.start_time,t.start_time
  100. startTime,t.end_time,t.end_time endTime,t.community_id,t.community_id communityId,
  101. td1.name feeTypeCdName,td2.name feeFlagName,t.bill_type billType,t.bill_type,td3.name billTypeName,
  102. t.payment_cd,t.payment_cycle,t.payment_cd paymentCd,t.payment_cycle paymentCycle,
  103. t.computing_formula_text,t.computing_formula_text computingFormulaText
  104. from pay_fee_config t,t_dict td1,t_dict td2,t_dict td3
  105. where 1 =1
  106. and t.fee_type_cd = td1.status_cd
  107. and td1.table_name = 'pay_fee_config'
  108. and td1.table_columns = 'fee_type_cd'
  109. and t.fee_flag = td2.status_cd
  110. and td2.table_name = 'pay_fee_config'
  111. and td2.table_columns = 'fee_flag'
  112. and t.bill_type = td3.status_cd
  113. and td3.table_name = 'pay_fee_config'
  114. and td3.table_columns = 'bill_type'
  115. <if test="feeTypeCd !=null and feeTypeCd != ''">
  116. and t.fee_type_cd= #{feeTypeCd}
  117. </if>
  118. <if test="computingFormula !=null and computingFormula != ''">
  119. and t.computing_formula= #{computingFormula}
  120. </if>
  121. <if test="additionalAmount !=null and additionalAmount != ''">
  122. and t.additional_amount= #{additionalAmount}
  123. </if>
  124. <if test="statusCd !=null and statusCd != ''">
  125. and t.status_cd= #{statusCd}
  126. </if>
  127. <if test="squarePrice !=null and squarePrice != ''">
  128. and t.square_price= #{squarePrice}
  129. </if>
  130. <if test="isDefault !=null and isDefault != ''">
  131. and t.is_default= #{isDefault}
  132. </if>
  133. <if test="configId !=null and configId != ''">
  134. and t.config_id= #{configId}
  135. </if>
  136. <if test="feeFlag !=null and feeFlag != ''">
  137. and t.fee_flag= #{feeFlag}
  138. </if>
  139. <if test="feeName !=null and feeName != ''">
  140. and t.fee_name like '%${feeName}%'
  141. </if>
  142. <if test="startTime !=null ">
  143. and t.start_time= #{startTime}
  144. </if>
  145. <if test="endTime !=null ">
  146. and t.end_time= #{endTime}
  147. </if>
  148. <if test="valid !=null and valid == 1">
  149. and t.end_time &gt; now()
  150. </if>
  151. <if test="curTime !=null ">
  152. and t.end_time &gt; #{curTime}
  153. and t.start_time &lt; #{curTime}
  154. </if>
  155. <if test="communityId !=null and communityId != ''">
  156. and t.community_id= #{communityId}
  157. </if>
  158. <if test="paymentCd !=null and paymentCd != ''">
  159. and t.payment_cd= #{paymentCd}
  160. </if>
  161. <if test="paymentCycle !=null and paymentCycle != ''">
  162. and t.payment_cycle= #{paymentCycle}
  163. </if>
  164. <if test="billType !=null and billType != ''">
  165. and t.bill_type= #{billType}
  166. </if>
  167. order by t.create_time desc
  168. <if test="page != -1 and page != null ">
  169. limit #{page}, #{row}
  170. </if>
  171. </select>
  172. </mapper>