ReportFeeMonthStatisticsServiceDaoImplMapper.xml 114 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573
  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,cur_max_time,
  11. his_owe_amount,cur_receivable_amount,cur_received_amount, his_owe_received_amount,pre_received_amount
  12. ) values (
  13. #{receivableAmount},#{statisticsId},#{updateTime},#{remark},#{objName},#{receivedAmount},#{feeYear},#{feeMonth},
  14. #{feeId},#{configId},#{objId},#{feeName},#{oweAmount},#{communityId},#{feeCreateTime},#{objType},#{deadlineTime},#{curMaxTime},
  15. #{hisOweAmount},#{curReceivableAmount},#{curReceivedAmount},#{hisOweReceivedAmount},#{preReceivedAmount}
  16. )
  17. </insert>
  18. <!-- 查询费用月统计信息 add by wuxw 2018-07-03 -->
  19. <select id="getReportFeeMonthStatisticsInfo" parameterType="Map" resultType="Map">
  20. select t.receivable_amount,t.receivable_amount receivableAmount,t.statistics_id,t.statistics_id
  21. statisticsId,t.update_time,t.update_time updateTime,t.remark,t.status_cd,t.status_cd
  22. statusCd,t.obj_name,t.obj_name objName,t.received_amount,t.received_amount receivedAmount,t.fee_year,t.fee_year
  23. feeYear,t.fee_month,t.fee_month feeMonth,t.fee_id,t.fee_id feeId,t.config_id,t.config_id
  24. configId,t.obj_id,t.obj_id objId,t.fee_name,t.fee_name feeName,t.owe_amount,t.owe_amount
  25. oweAmount,t.community_id,t.community_id communityId,t.fee_create_time,t.fee_create_time
  26. feeCreateTime,t.obj_type,t.obj_type objType,t.cur_max_time curMaxTime,
  27. t.his_owe_amount hisOweAmount,t.cur_receivable_amount curReceivableAmount,t.cur_received_amount
  28. curReceivedAmount,
  29. t.his_owe_received_amount hisOweReceivedAmount,t.pre_received_amount preReceivedAmount
  30. from report_fee_month_statistics t
  31. inner join pay_fee pf on t.fee_id = pf.fee_id and pf.community_id = t.community_id and pf.status_cd = '0'
  32. where 1 =1
  33. <if test="receivableAmount !=null and receivableAmount != ''">
  34. and t.receivable_amount= #{receivableAmount}
  35. </if>
  36. <if test="statisticsId !=null and statisticsId != ''">
  37. and t.statistics_id= #{statisticsId}
  38. </if>
  39. <if test="updateTime !=null and updateTime != ''">
  40. and t.update_time= #{updateTime}
  41. </if>
  42. <if test="remark !=null and remark != ''">
  43. and t.remark= #{remark}
  44. </if>
  45. <if test="statusCd !=null and statusCd != ''">
  46. and t.status_cd= #{statusCd}
  47. </if>
  48. <if test="objName !=null and objName != ''">
  49. and t.obj_name= #{objName}
  50. </if>
  51. <if test="receivedAmount !=null and receivedAmount != ''">
  52. and t.received_amount= #{receivedAmount}
  53. </if>
  54. <if test="feeYear !=null and feeYear != ''">
  55. and t.fee_year= #{feeYear}
  56. </if>
  57. <if test="feeMonth !=null and feeMonth != ''">
  58. and t.fee_month= #{feeMonth}
  59. </if>
  60. <if test="feeId !=null and feeId != ''">
  61. and t.fee_id= #{feeId}
  62. </if>
  63. <if test="configId !=null and configId != ''">
  64. and t.config_id= #{configId}
  65. </if>
  66. <if test="objId !=null and objId != ''">
  67. and t.obj_id= #{objId}
  68. </if>
  69. <if test="feeName !=null and feeName != ''">
  70. and t.fee_name= #{feeName}
  71. </if>
  72. <if test="oweAmount !=null and oweAmount != ''">
  73. and t.owe_amount= #{oweAmount}
  74. </if>
  75. <if test="communityId !=null and communityId != ''">
  76. and t.community_id= #{communityId}
  77. </if>
  78. <if test="feeCreateTime !=null and feeCreateTime != ''">
  79. and t.fee_create_time= #{feeCreateTime}
  80. </if>
  81. <if test="objType !=null and objType != ''">
  82. and t.obj_type= #{objType}
  83. </if>
  84. order by t.create_time desc
  85. <if test="page != -1 and page != null ">
  86. limit #{page}, #{row}
  87. </if>
  88. </select>
  89. <!-- 修改费用月统计信息 add by wuxw 2018-07-03 -->
  90. <update id="updateReportFeeMonthStatisticsOwe" parameterType="Map">
  91. update report_fee_month_statistics t set
  92. t.owe_amount= #{oweAmount}
  93. where 1=1
  94. <if test="statisticsId !=null and statisticsId != ''">
  95. and t.statistics_id= #{statisticsId}
  96. </if>
  97. <if test="curMaxTime !=null ">
  98. and t.cur_max_time &lt;= #{curMaxTime}
  99. </if>
  100. <if test="feeId !=null and feeId != ''">
  101. and t.fee_id= #{feeId}
  102. </if>
  103. </update>
  104. <!-- 修改费用月统计信息 add by wuxw 2018-07-03 -->
  105. <update id="updateReportFeeMonthStatisticsInfo" parameterType="Map">
  106. update report_fee_month_statistics t set t.status_cd = #{statusCd}
  107. <if test="newBId != null and newBId != ''">
  108. ,t.b_id = #{newBId}
  109. </if>
  110. <if test="receivableAmount !=null and receivableAmount != ''">
  111. , t.receivable_amount= #{receivableAmount}
  112. </if>
  113. <if test="updateTime !=null and updateTime != ''">
  114. , t.update_time= #{updateTime}
  115. </if>
  116. <if test="deadlineTime !=null ">
  117. , t.deadline_time= #{deadlineTime}
  118. </if>
  119. <if test="remark !=null and remark != ''">
  120. , t.remark= #{remark}
  121. </if>
  122. <if test="objName !=null and objName != ''">
  123. , t.obj_name= #{objName}
  124. </if>
  125. <if test="receivedAmount !=null and receivedAmount != ''">
  126. , t.received_amount= #{receivedAmount}
  127. </if>
  128. <if test="feeYear !=null and feeYear != ''">
  129. , t.fee_year= #{feeYear}
  130. </if>
  131. <if test="feeMonth !=null and feeMonth != ''">
  132. , t.fee_month= #{feeMonth}
  133. </if>
  134. <if test="feeId !=null and feeId != ''">
  135. , t.fee_id= #{feeId}
  136. </if>
  137. <if test="configId !=null and configId != ''">
  138. , t.config_id= #{configId}
  139. </if>
  140. <if test="objId !=null and objId != ''">
  141. , t.obj_id= #{objId}
  142. </if>
  143. <if test="feeName !=null and feeName != ''">
  144. , t.fee_name= #{feeName}
  145. </if>
  146. <if test="oweAmount !=null and oweAmount != ''">
  147. , t.owe_amount= #{oweAmount}
  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. <if test="hisOweAmount !=null and hisOweAmount != ''">
  156. , t.his_owe_amount= #{hisOweAmount}
  157. </if>
  158. <if test="curReceivableAmount !=null and curReceivableAmount != ''">
  159. , t.cur_receivable_amount= #{curReceivableAmount}
  160. </if>
  161. <if test="curReceivedAmount !=null and curReceivedAmount != ''">
  162. , t.cur_received_amount= #{curReceivedAmount}
  163. </if>
  164. <if test="hisOweReceivedAmount !=null and hisOweReceivedAmount != ''">
  165. , t.his_owe_received_amount= #{hisOweReceivedAmount}
  166. </if>
  167. <if test="preReceivedAmount !=null and preReceivedAmount != ''">
  168. , t.pre_received_amount= #{preReceivedAmount}
  169. </if>
  170. where 1=1
  171. and t.statistics_id= #{statisticsId}
  172. <if test="communityId !=null and communityId != ''">
  173. and t.community_id= #{communityId}
  174. </if>
  175. </update>
  176. <!-- 修改费用月统计信息 add by wuxw 2018-07-03 -->
  177. <update id="deleteReportFeeMonthStatisticsInfo" parameterType="Map">
  178. update report_fee_month_statistics t set t.status_cd = '1'
  179. where 1=1
  180. <if test="statisticsId !=null and statisticsId != ''">
  181. and t.statistics_id= #{statisticsId}
  182. </if>
  183. <if test="communityId !=null and communityId != ''">
  184. and t.community_id= #{communityId}
  185. </if>
  186. <if test="feeId !=null and feeId != ''">
  187. and t.fee_id= #{feeId}
  188. </if>
  189. <if test="configId !=null and configId != ''">
  190. and t.config_id= #{configId}
  191. </if>
  192. </update>
  193. <!-- 查询费用月统计数量 add by wuxw 2018-07-03 -->
  194. <select id="queryReportFeeMonthStatisticssCount" parameterType="Map" resultType="Map">
  195. select count(1) count
  196. from report_fee_month_statistics t
  197. inner join pay_fee pf on t.fee_id = pf.fee_id and pf.community_id = t.community_id and pf.status_cd = '0'
  198. where 1 =1
  199. <if test="receivableAmount !=null and receivableAmount != ''">
  200. and t.receivable_amount= #{receivableAmount}
  201. </if>
  202. <if test="statisticsId !=null and statisticsId != ''">
  203. and t.statistics_id= #{statisticsId}
  204. </if>
  205. <if test="updateTime !=null and updateTime != ''">
  206. and t.update_time= #{updateTime}
  207. </if>
  208. <if test="remark !=null and remark != ''">
  209. and t.remark= #{remark}
  210. </if>
  211. <if test="statusCd !=null and statusCd != ''">
  212. and t.status_cd= #{statusCd}
  213. </if>
  214. <if test="objName !=null and objName != ''">
  215. and t.obj_name= #{objName}
  216. </if>
  217. <if test="receivedAmount !=null and receivedAmount != ''">
  218. and t.received_amount= #{receivedAmount}
  219. </if>
  220. <if test="feeYear !=null and feeYear != ''">
  221. and t.fee_year= #{feeYear}
  222. </if>
  223. <if test="feeMonth !=null and feeMonth != ''">
  224. and t.fee_month= #{feeMonth}
  225. </if>
  226. <if test="feeId !=null and feeId != ''">
  227. and t.fee_id= #{feeId}
  228. </if>
  229. <if test="configId !=null and configId != ''">
  230. and t.config_id= #{configId}
  231. </if>
  232. <if test="objId !=null and objId != ''">
  233. and t.obj_id= #{objId}
  234. </if>
  235. <if test="feeName !=null and feeName != ''">
  236. and t.fee_name= #{feeName}
  237. </if>
  238. <if test="oweAmount !=null and oweAmount != ''">
  239. and t.owe_amount= #{oweAmount}
  240. </if>
  241. <if test="communityId !=null and communityId != ''">
  242. and t.community_id= #{communityId}
  243. </if>
  244. <if test="feeCreateTime !=null and feeCreateTime != ''">
  245. and t.fee_create_time= #{feeCreateTime}
  246. </if>
  247. <if test="objType !=null and objType != ''">
  248. and t.obj_type= #{objType}
  249. </if>
  250. </select>
  251. <!-- 查询费用月统计数量 add by wuxw 2018-07-03 -->
  252. <select id="queryReportFeeSummaryCount" parameterType="Map" resultType="Map">
  253. select count(1) count
  254. from (
  255. select t.fee_year,t.fee_month
  256. from report_fee_month_statistics t
  257. left join building_room br on t.obj_id = br.room_id and t.obj_type = '3333' and br.status_cd = '0'
  258. left join building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0'
  259. left join f_floor f on bu.floor_id = f.floor_id and f.status_cd = '0'
  260. inner join pay_fee pf on t.fee_id = pf.fee_id and pf.community_id = t.community_id and pf.status_cd = '0'
  261. where t.status_cd = '0'
  262. <if test="roomNum !=null and roomNum != ''">
  263. and br.room_num= #{roomNum}
  264. </if>
  265. <if test="unitId !=null and unitId != ''">
  266. and bu.unit_id= #{unitId}
  267. </if>
  268. <if test="floorId !=null and floorId != ''">
  269. and f.floor_id = #{floorId}
  270. </if>
  271. <if test="objName !=null and objName != ''">
  272. and t.obj_name= #{objName}
  273. </if>
  274. <if test="feeYear !=null and feeYear != ''">
  275. and t.fee_year= #{feeYear}
  276. </if>
  277. <if test="feeMonth !=null and feeMonth != ''">
  278. and t.fee_month= #{feeMonth}
  279. </if>
  280. <if test="feeId !=null and feeId != ''">
  281. and t.fee_id= #{feeId}
  282. </if>
  283. <if test="configId !=null and configId != ''">
  284. and t.config_id= #{configId}
  285. </if>
  286. <if test="configIds !=null">
  287. and t.config_id in
  288. <foreach collection="configIds" item="item" open="(" close=")" separator=",">
  289. #{item}
  290. </foreach>
  291. </if>
  292. <if test="objId !=null and objId != ''">
  293. and t.obj_id= #{objId}
  294. </if>
  295. <if test="feeName !=null and feeName != ''">
  296. and t.fee_name= #{feeName}
  297. </if>
  298. <if test="communityId !=null and communityId != ''">
  299. and t.community_id= #{communityId}
  300. </if>
  301. <if test="startTime !=null and startTime != ''">
  302. and t.create_time &gt;= #{startTime}
  303. </if>
  304. <if test="endTime !=null and endTime != ''">
  305. and t.create_time &lt;= #{endTime}
  306. </if>
  307. group by t.fee_year,t.fee_month
  308. ) t
  309. </select>
  310. <!-- 查询费用月统计信息 add by wuxw 2018-07-03 -->
  311. <select id="queryReportFeeSummary" parameterType="Map" resultType="Map">
  312. select t.fee_year feeYear,t.fee_month feeMonth,t.create_time createTime
  313. <if test="configIds !=null">
  314. ,t.config_id configId
  315. </if>
  316. ,SUM(t.his_owe_amount) hisOweAmount,SUM(t.cur_receivable_amount) curReceivableAmount,
  317. SUM(t.cur_received_amount) curReceivedAmount,SUM(t.his_owe_received_amount)
  318. hisOweReceivedAmount,SUM(t.pre_received_amount) preReceivedAmount,
  319. max(t.update_time) updateTime,sum(t.his_owe_amount+t.cur_receivable_amount)
  320. receivableAmount,sum(t.cur_received_amount+t.his_owe_received_amount+t.pre_received_amount) receivedAmount
  321. from report_fee_month_statistics t
  322. left join building_room br on t.obj_id = br.room_id and t.obj_type = '3333' and br.status_cd = '0'
  323. left join building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0'
  324. left join f_floor f on bu.floor_id = f.floor_id and f.status_cd = '0'
  325. inner join pay_fee pf on t.fee_id = pf.fee_id and pf.community_id = t.community_id and pf.status_cd = '0'
  326. where t.status_cd = '0'
  327. <if test="roomNum !=null and roomNum != ''">
  328. and br.room_num= #{roomNum}
  329. </if>
  330. <if test="unitId !=null and unitId != ''">
  331. and bu.unit_id= #{unitId}
  332. </if>
  333. <if test="floorId !=null and floorId != ''">
  334. and f.floor_id = #{floorId}
  335. </if>
  336. <if test="objName !=null and objName != ''">
  337. and t.obj_name= #{objName}
  338. </if>
  339. <if test="feeYear !=null and feeYear != ''">
  340. and t.fee_year= #{feeYear}
  341. </if>
  342. <if test="feeMonth !=null and feeMonth != ''">
  343. and t.fee_month= #{feeMonth}
  344. </if>
  345. <if test="feeId !=null and feeId != ''">
  346. and t.fee_id= #{feeId}
  347. </if>
  348. <if test="configId !=null and configId != ''">
  349. and t.config_id= #{configId}
  350. </if>
  351. <if test="configIds !=null">
  352. and t.config_id in
  353. <foreach collection="configIds" item="item" open="(" close=")" separator=",">
  354. #{item}
  355. </foreach>
  356. </if>
  357. <if test="objId !=null and objId != ''">
  358. and t.obj_id= #{objId}
  359. </if>
  360. <if test="feeName !=null and feeName != ''">
  361. and t.fee_name= #{feeName}
  362. </if>
  363. <if test="communityId !=null and communityId != ''">
  364. and t.community_id= #{communityId}
  365. </if>
  366. <if test="startTime !=null and startTime != ''">
  367. and t.create_time &gt;= #{startTime}
  368. </if>
  369. <if test="endTime !=null and endTime != ''">
  370. and t.create_time &lt;= #{endTime}
  371. </if>
  372. group by t.fee_year,t.fee_month
  373. <if test="configIds !=null">
  374. ,t.config_id
  375. </if>
  376. <if test="page != -1 and page != null ">
  377. limit #{page}, #{row}
  378. </if>
  379. </select>
  380. <!-- 查询费用月统计信息 大计 add by wuxw 2018-07-03 -->
  381. <select id="queryReportFeeSummaryMajor" parameterType="Map" resultType="Map">
  382. select
  383. sum(t.cur_received_amount+t.his_owe_received_amount+t.pre_received_amount) allReceivedAmount,
  384. sum(t.his_owe_received_amount) allHisOweReceivedAmount
  385. from report_fee_month_statistics t
  386. left join building_room br on t.obj_id = br.room_id and t.obj_type = '3333' and br.status_cd = '0'
  387. left join building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0'
  388. left join f_floor f on bu.floor_id = f.floor_id and f.status_cd = '0'
  389. inner join pay_fee pf on t.fee_id = pf.fee_id and pf.community_id = t.community_id and pf.status_cd = '0'
  390. where t.status_cd = '0'
  391. <if test="roomNum !=null and roomNum != ''">
  392. and br.room_num= #{roomNum}
  393. </if>
  394. <if test="unitId !=null and unitId != ''">
  395. and bu.unit_id= #{unitId}
  396. </if>
  397. <if test="floorId !=null and floorId != ''">
  398. and f.floor_id = #{floorId}
  399. </if>
  400. <if test="objName !=null and objName != ''">
  401. and t.obj_name= #{objName}
  402. </if>
  403. <if test="feeYear !=null and feeYear != ''">
  404. and t.fee_year= #{feeYear}
  405. </if>
  406. <if test="feeMonth !=null and feeMonth != ''">
  407. and t.fee_month= #{feeMonth}
  408. </if>
  409. <if test="feeId !=null and feeId != ''">
  410. and t.fee_id= #{feeId}
  411. </if>
  412. <if test="configId !=null and configId != ''">
  413. and t.config_id= #{configId}
  414. </if>
  415. <if test="configIds !=null">
  416. and t.config_id in
  417. <foreach collection="configIds" item="item" open="(" close=")" separator=",">
  418. #{item}
  419. </foreach>
  420. </if>
  421. <if test="objId !=null and objId != ''">
  422. and t.obj_id= #{objId}
  423. </if>
  424. <if test="feeName !=null and feeName != ''">
  425. and t.fee_name= #{feeName}
  426. </if>
  427. <if test="communityId !=null and communityId != ''">
  428. and t.community_id= #{communityId}
  429. </if>
  430. <if test="startTime !=null and startTime != ''">
  431. and t.create_time &gt;= #{startTime}
  432. </if>
  433. <if test="endTime !=null and endTime != ''">
  434. and t.create_time &lt;= #{endTime}
  435. </if>
  436. </select>
  437. <select id="queryReportFloorUnitFeeSummaryCount" parameterType="Map" resultType="Map">
  438. select count(1) count
  439. from (
  440. select t.fee_year feeYear,t.fee_month feeMonth, f.floor_num flooNum, bu.unit_num unitNum
  441. from report_fee_month_statistics t
  442. INNER JOIN building_room br on t.obj_id = br.room_id and br.status_cd = '0'
  443. inner join building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0'
  444. inner join f_floor f on bu.floor_id = f.floor_id and f.status_cd = '0'
  445. inner join pay_fee pf on t.fee_id = pf.fee_id and pf.community_id = t.community_id and pf.status_cd = '0'
  446. where t.status_cd = '0'
  447. <if test="roomNum !=null and roomNum != ''">
  448. and br.room_num= #{roomNum}
  449. </if>
  450. <if test="unitId !=null and unitId != ''">
  451. and bu.unit_id= #{unitId}
  452. </if>
  453. <if test="floorId !=null and floorId != ''">
  454. and f.floor_id = #{floorId}
  455. </if>
  456. <if test="objName !=null and objName != ''">
  457. and t.obj_name= #{objName}
  458. </if>
  459. <if test="feeYear !=null and feeYear != ''">
  460. and t.fee_year= #{feeYear}
  461. </if>
  462. <if test="feeMonth !=null and feeMonth != ''">
  463. and t.fee_month= #{feeMonth}
  464. </if>
  465. <if test="feeId !=null and feeId != ''">
  466. and t.fee_id= #{feeId}
  467. </if>
  468. <if test="configId !=null and configId != ''">
  469. and t.config_id= #{configId}
  470. </if>
  471. <if test="configIds !=null">
  472. and t.config_id in
  473. <foreach collection="configIds" item="item" open="(" close=")" separator=",">
  474. #{item}
  475. </foreach>
  476. </if>
  477. <if test="objId !=null and objId != ''">
  478. and t.obj_id= #{objId}
  479. </if>
  480. <if test="feeName !=null and feeName != ''">
  481. and t.fee_name= #{feeName}
  482. </if>
  483. <if test="communityId !=null and communityId != ''">
  484. and t.community_id= #{communityId}
  485. </if>
  486. <if test="startTime !=null and startTime != ''">
  487. and t.create_time &gt;= #{startTime}
  488. </if>
  489. <if test="endTime !=null and endTime != ''">
  490. and t.create_time &lt;= #{endTime}
  491. </if>
  492. GROUP BY t.fee_year,t.fee_month,f.floor_num,bu.unit_id,bu.unit_num
  493. ) t
  494. </select>
  495. <!-- 查询费用月统计信息 add by wuxw 2018-07-03 -->
  496. <select id="queryReportFloorUnitFeeSummary" parameterType="Map" resultType="Map">
  497. select t.fee_year feeYear,t.fee_month feeMonth, f.floor_num floorNum, bu.unit_num unitNum,max(t.update_time)
  498. updateTime
  499. <if test="configIds !=null">
  500. ,t.config_id configId
  501. </if>
  502. ,SUM(t.his_owe_amount) hisOweAmount,SUM(t.cur_receivable_amount) curReceivableAmount,
  503. SUM(t.cur_received_amount) curReceivedAmount,SUM(t.his_owe_received_amount)
  504. hisOweReceivedAmount,SUM(t.pre_received_amount) preReceivedAmount,
  505. max(t.update_time) updateTime,sum(t.his_owe_amount+t.cur_receivable_amount) receivableAmount,
  506. sum(t.cur_received_amount+t.his_owe_received_amount+t.pre_received_amount) receivedAmount
  507. from report_fee_month_statistics t
  508. INNER JOIN building_room br on t.obj_id = br.room_id and br.status_cd = '0'
  509. inner join building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0'
  510. inner join f_floor f on bu.floor_id = f.floor_id and f.status_cd = '0'
  511. inner join pay_fee pf on t.fee_id = pf.fee_id and pf.community_id = t.community_id and pf.status_cd = '0'
  512. where t.status_cd = '0'
  513. <if test="roomNum !=null and roomNum != ''">
  514. and br.room_num= #{roomNum}
  515. </if>
  516. <if test="unitId !=null and unitId != ''">
  517. and bu.unit_id= #{unitId}
  518. </if>
  519. <if test="floorId !=null and floorId != ''">
  520. and f.floor_id = #{floorId}
  521. </if>
  522. <if test="objName !=null and objName != ''">
  523. and t.obj_name= #{objName}
  524. </if>
  525. <if test="feeYear !=null and feeYear != ''">
  526. and t.fee_year= #{feeYear}
  527. </if>
  528. <if test="feeMonth !=null and feeMonth != ''">
  529. and t.fee_month= #{feeMonth}
  530. </if>
  531. <if test="feeId !=null and feeId != ''">
  532. and t.fee_id= #{feeId}
  533. </if>
  534. <if test="configId !=null and configId != ''">
  535. and t.config_id= #{configId}
  536. </if>
  537. <if test="configIds !=null">
  538. and t.config_id in
  539. <foreach collection="configIds" item="item" open="(" close=")" separator=",">
  540. #{item}
  541. </foreach>
  542. </if>
  543. <if test="objId !=null and objId != ''">
  544. and t.obj_id= #{objId}
  545. </if>
  546. <if test="feeName !=null and feeName != ''">
  547. and t.fee_name= #{feeName}
  548. </if>
  549. <if test="communityId !=null and communityId != ''">
  550. and t.community_id= #{communityId}
  551. </if>
  552. <if test="startTime !=null and startTime != ''">
  553. and t.create_time &gt;= #{startTime}
  554. </if>
  555. <if test="endTime !=null and endTime != ''">
  556. and t.create_time &lt;= #{endTime}
  557. </if>
  558. GROUP BY t.fee_year,t.fee_month,f.floor_num,bu.unit_id,bu.unit_num
  559. <if test="configIds !=null">
  560. ,t.config_id
  561. </if>
  562. <if test="page != -1 and page != null ">
  563. limit #{page}, #{row}
  564. </if>
  565. </select>
  566. <!-- 查询费用月统计信息 add by wuxw 2018-07-03 -->
  567. <select id="queryReportFloorUnitFeeSummaryMajor" parameterType="Map" resultType="Map">
  568. select
  569. sum(t.cur_received_amount+t.his_owe_received_amount+t.pre_received_amount) allReceivedAmount,
  570. sum(t.his_owe_received_amount) allHisOweReceivedAmount
  571. from report_fee_month_statistics t
  572. INNER JOIN building_room br on t.obj_id = br.room_id and br.status_cd = '0'
  573. inner join building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0'
  574. inner join f_floor f on bu.floor_id = f.floor_id and f.status_cd = '0'
  575. inner join pay_fee pf on t.fee_id = pf.fee_id and pf.community_id = t.community_id and pf.status_cd = '0'
  576. where t.status_cd = '0'
  577. <if test="roomNum !=null and roomNum != ''">
  578. and br.room_num= #{roomNum}
  579. </if>
  580. <if test="unitId !=null and unitId != ''">
  581. and bu.unit_id= #{unitId}
  582. </if>
  583. <if test="floorId !=null and floorId != ''">
  584. and f.floor_id = #{floorId}
  585. </if>
  586. <if test="objName !=null and objName != ''">
  587. and t.obj_name= #{objName}
  588. </if>
  589. <if test="feeYear !=null and feeYear != ''">
  590. and t.fee_year= #{feeYear}
  591. </if>
  592. <if test="feeMonth !=null and feeMonth != ''">
  593. and t.fee_month= #{feeMonth}
  594. </if>
  595. <if test="feeId !=null and feeId != ''">
  596. and t.fee_id= #{feeId}
  597. </if>
  598. <if test="configId !=null and configId != ''">
  599. and t.config_id= #{configId}
  600. </if>
  601. <if test="objId !=null and objId != ''">
  602. and t.obj_id= #{objId}
  603. </if>
  604. <if test="feeName !=null and feeName != ''">
  605. and t.fee_name= #{feeName}
  606. </if>
  607. <if test="communityId !=null and communityId != ''">
  608. and t.community_id= #{communityId}
  609. </if>
  610. <if test="startTime !=null and startTime != ''">
  611. and t.create_time &gt;= #{startTime}
  612. </if>
  613. <if test="endTime !=null and endTime != ''">
  614. and t.create_time &lt;= #{endTime}
  615. </if>
  616. </select>
  617. <!--
  618. and t.receivable_amount >= 0 and t.received_amount >= 0 and t.owe_amount >= 0
  619. -->
  620. <select id="queryFeeBreakdownCount" parameterType="Map" resultType="Map">
  621. select count(1) count
  622. from (
  623. select t.fee_name feeName,td.name feeTypeCd,pfc.fee_type_cd,pfc.start_time feeCreateTime,t.create_time
  624. createTime
  625. from report_fee_month_statistics t
  626. inner join pay_fee_config pfc on t.config_id = pfc.config_id and pfc.status_cd = '0'
  627. left join building_room br on t.obj_id = br.room_id and t.obj_type = '3333' and br.status_cd = '0'
  628. left join building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0'
  629. left join f_floor f on bu.floor_id = f.floor_id and f.status_cd = '0'
  630. left join t_dict td on pfc.fee_type_cd = td.status_cd and td.table_name='pay_fee_config' and
  631. td.table_columns='fee_type_cd'
  632. inner join pay_fee pf on t.fee_id = pf.fee_id and pf.community_id = t.community_id and pf.status_cd = '0'
  633. where t.status_cd = '0'
  634. <if test="roomNum !=null and roomNum != ''">
  635. and br.room_num= #{roomNum}
  636. </if>
  637. <if test="unitId !=null and unitId != ''">
  638. and bu.unit_id= #{unitId}
  639. </if>
  640. <if test="floorId !=null and floorId != ''">
  641. and f.floor_id = #{floorId}
  642. </if>
  643. <if test="objName !=null and objName != ''">
  644. and t.obj_name= #{objName}
  645. </if>
  646. <if test="feeYear !=null and feeYear != ''">
  647. and t.fee_year= #{feeYear}
  648. </if>
  649. <if test="feeMonth !=null and feeMonth != ''">
  650. and t.fee_month= #{feeMonth}
  651. </if>
  652. <if test="feeId !=null and feeId != ''">
  653. and t.fee_id= #{feeId}
  654. </if>
  655. <if test="configId !=null and configId != ''">
  656. and pfc.config_id= #{configId}
  657. </if>
  658. <if test="objId !=null and objId != ''">
  659. and t.obj_id= #{objId}
  660. </if>
  661. <if test="feeName !=null and feeName != ''">
  662. and t.fee_name= #{feeName}
  663. </if>
  664. <if test="feeTypeCd != null and feeTypeCd != ''">
  665. and pfc.fee_type_cd = #{feeTypeCd}
  666. </if>
  667. <if test="communityId !=null and communityId != ''">
  668. and t.community_id= #{communityId}
  669. </if>
  670. <if test="startTime !=null and startTime != ''">
  671. and pfc.start_time &gt;= #{startTime}
  672. </if>
  673. <if test="endTime !=null and endTime != ''">
  674. and pfc.start_time &lt;= #{endTime}
  675. </if>
  676. <if test="yearMonth !=null and yearMonth != ''">
  677. and concat(t.fee_year,t.fee_month) = #{yearMonth}
  678. </if>
  679. group by t.config_id,t.fee_name,pfc.start_time
  680. ) t
  681. </select>
  682. <!-- 查询费用月统计信息 add by wuxw 2018-07-03
  683. and t.receivable_amount >= 0 and t.received_amount >= 0 and t.owe_amount >= 0
  684. -->
  685. <select id="queryFeeBreakdown" parameterType="Map" resultType="Map">
  686. select t.fee_name feeName,td.name feeTypeCd,pfc.fee_type_cd,SUM(t.his_owe_amount)
  687. hisOweAmount,SUM(t.cur_receivable_amount) curReceivableAmount,
  688. SUM(t.cur_received_amount) curReceivedAmount,SUM(t.his_owe_received_amount)
  689. hisOweReceivedAmount,SUM(t.pre_received_amount) preReceivedAmount,
  690. max(t.update_time) updateTime,sum(t.his_owe_amount+t.cur_receivable_amount) receivableAmount,
  691. sum(t.cur_received_amount+t.his_owe_received_amount+t.pre_received_amount) receivedAmount,max(t.update_time)
  692. updateTime
  693. from report_fee_month_statistics t
  694. inner join pay_fee_config pfc on t.config_id = pfc.config_id and pfc.status_cd = '0'
  695. left join building_room br on t.obj_id = br.room_id and t.obj_type = '3333' and br.status_cd = '0'
  696. left join building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0'
  697. left join f_floor f on bu.floor_id = f.floor_id and f.status_cd = '0'
  698. left join t_dict td on pfc.fee_type_cd = td.status_cd and td.table_name='pay_fee_config' and
  699. td.table_columns='fee_type_cd'
  700. inner join pay_fee pf on t.fee_id = pf.fee_id and pf.community_id = t.community_id and pf.status_cd = '0'
  701. where t.status_cd = '0'
  702. <if test="roomNum !=null and roomNum != ''">
  703. and br.room_num= #{roomNum}
  704. </if>
  705. <if test="unitId !=null and unitId != ''">
  706. and bu.unit_id= #{unitId}
  707. </if>
  708. <if test="floorId !=null and floorId != ''">
  709. and f.floor_id = #{floorId}
  710. </if>
  711. <if test="objName !=null and objName != ''">
  712. and t.obj_name= #{objName}
  713. </if>
  714. <if test="feeYear !=null and feeYear != ''">
  715. and t.fee_year= #{feeYear}
  716. </if>
  717. <if test="feeMonth !=null and feeMonth != ''">
  718. and t.fee_month= #{feeMonth}
  719. </if>
  720. <if test="feeId !=null and feeId != ''">
  721. and t.fee_id= #{feeId}
  722. </if>
  723. <if test="configId !=null and configId != ''">
  724. and pfc.config_id= #{configId}
  725. </if>
  726. <if test="objId !=null and objId != ''">
  727. and t.obj_id= #{objId}
  728. </if>
  729. <if test="feeName !=null and feeName != ''">
  730. and t.fee_name= #{feeName}
  731. </if>
  732. <if test="feeTypeCd != null and feeTypeCd != ''">
  733. and pfc.fee_type_cd = #{feeTypeCd}
  734. </if>
  735. <if test="communityId !=null and communityId != ''">
  736. and t.community_id= #{communityId}
  737. </if>
  738. <if test="startTime !=null and startTime != ''">
  739. and pfc.start_time &gt;= #{startTime}
  740. </if>
  741. <if test="endTime !=null and endTime != ''">
  742. and pfc.start_time &lt;= #{endTime}
  743. </if>
  744. <if test="yearMonth !=null and yearMonth != ''">
  745. and concat(t.fee_year,t.fee_month) = #{yearMonth}
  746. </if>
  747. group by t.config_id,t.fee_name,pfc.start_time
  748. order by t.create_time desc
  749. <if test="page != -1 and page != null ">
  750. limit #{page}, #{row}
  751. </if>
  752. </select>
  753. <!-- 查询费用月统计信息 add by wuxw 2018-07-03 and t.receivable_amount >= 0 and t.received_amount >= 0 and t.owe_amount >= 0 -->
  754. <select id="queryFeeBreakdownMajor" parameterType="Map" resultType="Map">
  755. select
  756. SUM(t.his_owe_amount + t.cur_receivable_amount) allReceivableAmount,
  757. SUM(t.cur_received_amount+t.his_owe_received_amount+t.pre_received_amount) allReceivedAmount,
  758. if(SUM(t.his_owe_amount + t.cur_receivable_amount - t.cur_received_amount - t.his_owe_received_amount) &lt; 0,0,
  759. SUM(t.his_owe_amount + t.cur_receivable_amount - t.cur_received_amount - t.his_owe_received_amount)) allOweAmount,
  760. SUM(t.his_owe_received_amount) allHisOweReceivedAmount
  761. from report_fee_month_statistics t
  762. inner join pay_fee_config pfc on t.config_id = pfc.config_id and pfc.status_cd = '0'
  763. left join building_room br on t.obj_id = br.room_id and t.obj_type = '3333' and br.status_cd = '0'
  764. left join building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0'
  765. left join f_floor f on bu.floor_id = f.floor_id and f.status_cd = '0'
  766. left join t_dict td on pfc.fee_type_cd = td.status_cd and td.table_name='pay_fee_config' and
  767. td.table_columns='fee_type_cd'
  768. inner join pay_fee pf on t.fee_id = pf.fee_id and pf.community_id = t.community_id and pf.status_cd = '0'
  769. where t.status_cd = '0'
  770. <if test="roomNum !=null and roomNum != ''">
  771. and br.room_num= #{roomNum}
  772. </if>
  773. <if test="unitId !=null and unitId != ''">
  774. and bu.unit_id= #{unitId}
  775. </if>
  776. <if test="floorId !=null and floorId != ''">
  777. and f.floor_id = #{floorId}
  778. </if>
  779. <if test="objName !=null and objName != ''">
  780. and t.obj_name= #{objName}
  781. </if>
  782. <if test="feeYear !=null and feeYear != ''">
  783. and t.fee_year= #{feeYear}
  784. </if>
  785. <if test="feeMonth !=null and feeMonth != ''">
  786. and t.fee_month= #{feeMonth}
  787. </if>
  788. <if test="feeId !=null and feeId != ''">
  789. and t.fee_id= #{feeId}
  790. </if>
  791. <if test="configId !=null and configId != ''">
  792. and pfc.config_id= #{configId}
  793. </if>
  794. <if test="objId !=null and objId != ''">
  795. and t.obj_id= #{objId}
  796. </if>
  797. <if test="feeName !=null and feeName != ''">
  798. and t.fee_name= #{feeName}
  799. </if>
  800. <if test="feeTypeCd != null and feeTypeCd != ''">
  801. and pfc.fee_type_cd = #{feeTypeCd}
  802. </if>
  803. <if test="communityId !=null and communityId != ''">
  804. and t.community_id= #{communityId}
  805. </if>
  806. <if test="startTime !=null and startTime != ''">
  807. and pfc.start_time &gt;= #{startTime}
  808. </if>
  809. <if test="endTime !=null and endTime != ''">
  810. and pfc.start_time &lt;= #{endTime}
  811. </if>
  812. <if test="yearMonth !=null and yearMonth != ''">
  813. and concat(t.fee_year,t.fee_month) = #{yearMonth}
  814. </if>
  815. order by t.create_time desc
  816. </select>
  817. <select id="queryFeeDetailCount" parameterType="Map" resultType="Map">
  818. select count(1) count
  819. from (
  820. select t.obj_name objName,t.fee_name feeName,pfc.start_time
  821. from report_fee_month_statistics t
  822. inner join pay_fee_config pfc on t.config_id = pfc.config_id and pfc.status_cd = '0'
  823. left join building_room br on t.obj_id = br.room_id and t.obj_type = '3333' and br.status_cd = '0'
  824. left join building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0'
  825. left join f_floor f on bu.floor_id = f.floor_id and f.status_cd = '0'
  826. inner join pay_fee pf on t.fee_id = pf.fee_id and pf.community_id = t.community_id and pf.status_cd = '0'
  827. where t.status_cd = '0'
  828. <if test="roomNum !=null and roomNum != ''">
  829. and br.room_num= #{roomNum}
  830. </if>
  831. <if test="unitId !=null and unitId != ''">
  832. and bu.unit_id= #{unitId}
  833. </if>
  834. <if test="floorId !=null and floorId != ''">
  835. and f.floor_id = #{floorId}
  836. </if>
  837. <if test="objName !=null and objName != ''">
  838. and t.obj_name= #{objName}
  839. </if>
  840. <if test="feeYear !=null and feeYear != ''">
  841. and t.fee_year= #{feeYear}
  842. </if>
  843. <if test="feeMonth !=null and feeMonth != ''">
  844. and t.fee_month= #{feeMonth}
  845. </if>
  846. <if test="feeId !=null and feeId != ''">
  847. and t.fee_id= #{feeId}
  848. </if>
  849. <if test="configId !=null and configId != ''">
  850. and t.config_id= #{configId}
  851. </if>
  852. <if test="objId !=null and objId != ''">
  853. and t.obj_id= #{objId}
  854. </if>
  855. <if test="feeName !=null and feeName != ''">
  856. and t.fee_name= #{feeName}
  857. </if>
  858. <if test="communityId !=null and communityId != ''">
  859. and t.community_id= #{communityId}
  860. </if>
  861. <if test="startTime !=null and startTime != ''">
  862. and t.create_time &gt;= #{startTime}
  863. </if>
  864. <if test="endTime !=null and endTime != ''">
  865. and t.create_time &lt;= #{endTime}
  866. </if>
  867. group by t.config_id,t.fee_name,t.fee_create_time,t.obj_id,t.obj_name,t.deadline_time
  868. ) t
  869. </select>
  870. <!-- 查询费用月统计信息 add by wuxw 2018-07-03 -->
  871. <select id="queryFeeDetail" parameterType="Map" resultType="Map">
  872. select t.obj_name objName,t.fee_name feeName,t.fee_create_time feeCreateTime,pfa.`value`
  873. ownerName,br.built_up_area builtUpArea ,max(t.deadline_time)
  874. deadlineTime,t.create_time createTime,SUM(t.receivable_amount) receivableAmount,SUM(t.received_amount)
  875. receivedAmount,SUM(t.owe_amount) oweAmount,max(t.update_time) updateTime
  876. from report_fee_month_statistics t
  877. inner join pay_fee_config pfc on t.config_id = pfc.config_id and pfc.status_cd = '0'
  878. left join building_room br on t.obj_id = br.room_id and t.obj_type = '3333' and br.status_cd = '0'
  879. left join building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0'
  880. left join f_floor f on bu.floor_id = f.floor_id and f.status_cd = '0'
  881. inner join pay_fee pf on t.fee_id = pf.fee_id and pf.community_id = t.community_id and pf.status_cd = '0'
  882. left join pay_fee_attrs pfa on pf.fee_id = pfa.fee_id and pfa.spec_cd = '390008' and pfa.status_cd ='0'
  883. where t.status_cd = '0' and t.receivable_amount >=0 and t.receivable_amount >= 0
  884. <if test="roomNum !=null and roomNum != ''">
  885. and br.room_num= #{roomNum}
  886. </if>
  887. <if test="unitId !=null and unitId != ''">
  888. and bu.unit_id= #{unitId}
  889. </if>
  890. <if test="floorId !=null and floorId != ''">
  891. and f.floor_id = #{floorId}
  892. </if>
  893. <if test="objName !=null and objName != ''">
  894. and t.obj_name= #{objName}
  895. </if>
  896. <if test="feeYear !=null and feeYear != ''">
  897. and t.fee_year= #{feeYear}
  898. </if>
  899. <if test="feeMonth !=null and feeMonth != ''">
  900. and t.fee_month= #{feeMonth}
  901. </if>
  902. <if test="feeId !=null and feeId != ''">
  903. and t.fee_id= #{feeId}
  904. </if>
  905. <if test="configId !=null and configId != ''">
  906. and t.config_id= #{configId}
  907. </if>
  908. <if test="objId !=null and objId != ''">
  909. and t.obj_id= #{objId}
  910. </if>
  911. <if test="feeName !=null and feeName != ''">
  912. and t.fee_name= #{feeName}
  913. </if>
  914. <if test="communityId !=null and communityId != ''">
  915. and t.community_id= #{communityId}
  916. </if>
  917. <if test="startTime !=null and startTime != ''">
  918. and t.create_time &gt;= #{startTime}
  919. </if>
  920. <if test="endTime !=null and endTime != ''">
  921. and t.create_time &lt;= #{endTime}
  922. </if>
  923. group by t.config_id,t.fee_name,t.fee_create_time,t.obj_id,t.obj_name,pfa.`value`,br.built_up_area
  924. <if test="page != -1 and page != null ">
  925. limit #{page}, #{row}
  926. </if>
  927. </select>
  928. <!-- 查询费用月统计信息 add by wuxw 2018-07-03 -->
  929. <select id="queryAllFeeDetail" parameterType="Map" resultType="Map">
  930. select SUM(t.receivable_amount) allReceivableAmount,SUM(t.received_amount) allReceivedAmount,
  931. SUM(t.owe_amount) allOweAmount from report_fee_month_statistics t
  932. inner join pay_fee_config pfc on t.config_id = pfc.config_id and pfc.status_cd = '0'
  933. left join building_room br on t.obj_id = br.room_id and t.obj_type = '3333' and br.status_cd = '0'
  934. left join building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0'
  935. left join f_floor f on bu.floor_id = f.floor_id and f.status_cd = '0'
  936. inner join pay_fee pf on t.fee_id = pf.fee_id and pf.community_id = t.community_id and pf.status_cd = '0'
  937. where t.status_cd = '0'
  938. <if test="roomNum !=null and roomNum != ''">
  939. and br.room_num= #{roomNum}
  940. </if>
  941. <if test="unitId !=null and unitId != ''">
  942. and bu.unit_id= #{unitId}
  943. </if>
  944. <if test="floorId !=null and floorId != ''">
  945. and f.floor_id = #{floorId}
  946. </if>
  947. <if test="objName !=null and objName != ''">
  948. and t.obj_name= #{objName}
  949. </if>
  950. <if test="feeYear !=null and feeYear != ''">
  951. and t.fee_year= #{feeYear}
  952. </if>
  953. <if test="feeMonth !=null and feeMonth != ''">
  954. and t.fee_month= #{feeMonth}
  955. </if>
  956. <if test="feeId !=null and feeId != ''">
  957. and t.fee_id= #{feeId}
  958. </if>
  959. <if test="configId !=null and configId != ''">
  960. and t.config_id= #{configId}
  961. </if>
  962. <if test="objId !=null and objId != ''">
  963. and t.obj_id= #{objId}
  964. </if>
  965. <if test="feeName !=null and feeName != ''">
  966. and t.fee_name= #{feeName}
  967. </if>
  968. <if test="communityId !=null and communityId != ''">
  969. and t.community_id= #{communityId}
  970. </if>
  971. <if test="startTime !=null and startTime != ''">
  972. and t.create_time &gt;= #{startTime}
  973. </if>
  974. <if test="endTime !=null and endTime != ''">
  975. and t.create_time &lt;= #{endTime}
  976. </if>
  977. </select>
  978. <select id="queryOweFeeDetailCount" parameterType="Map" resultType="Map">
  979. select count(1) count
  980. from (
  981. select t.payer_obj_name objName,t.fee_name feeName,pf.end_time feeCreateTime,t.create_time
  982. createTime,SUM(t.amount_owed) oweAmount,max(t.deadline_time) deadlineTime
  983. from report_owe_fee t
  984. inner join pay_fee_config pfc on t.config_id = pfc.config_id and pfc.status_cd = '0'
  985. left join building_room br on t.payer_obj_id = br.room_id and t.payer_obj_type = '3333' and br.status_cd = '0'
  986. left join building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0'
  987. left join f_floor f on bu.floor_id = f.floor_id and f.status_cd = '0'
  988. inner join pay_fee pf on t.fee_id = pf.fee_id and pf.community_id = t.community_id and pf.status_cd = '0'
  989. where 1=1
  990. <if test="roomNum !=null and roomNum != ''">
  991. and br.room_num= #{roomNum}
  992. </if>
  993. <if test="unitId !=null and unitId != ''">
  994. and bu.unit_id= #{unitId}
  995. </if>
  996. <if test="floorId !=null and floorId != ''">
  997. and f.floor_id = #{floorId}
  998. </if>
  999. <if test="objName !=null and objName != ''">
  1000. and t.payer_obj_name= #{objName}
  1001. </if>
  1002. <if test="feeId !=null and feeId != ''">
  1003. and t.fee_id= #{feeId}
  1004. </if>
  1005. <if test="configId !=null and configId != ''">
  1006. and t.config_id= #{configId}
  1007. </if>
  1008. <if test="objId !=null and objId != ''">
  1009. and t.payer_obj_id= #{objId}
  1010. </if>
  1011. <if test="feeName !=null and feeName != ''">
  1012. and t.fee_name= #{feeName}
  1013. </if>
  1014. <if test="communityId !=null and communityId != ''">
  1015. and t.community_id= #{communityId}
  1016. </if>
  1017. <if test="startTime !=null and startTime != ''">
  1018. and t.create_time &gt;= #{startTime}
  1019. </if>
  1020. <if test="endTime !=null and endTime != ''">
  1021. and t.create_time &lt;= #{endTime}
  1022. </if>
  1023. group by t.fee_name,t.payer_obj_id,t.payer_obj_name
  1024. HAVING oweAmount > 0
  1025. ) t
  1026. </select>
  1027. <!-- 查询费用月统计信息 add by wuxw 2018-07-03 -->
  1028. <select id="queryOweFeeDetail" parameterType="Map" resultType="Map">
  1029. select t.payer_obj_name objName,t.fee_name feeName,pf.end_time feeCreateTime,t.update_time
  1030. updateTime,pfa.`value` ownerName,br.built_up_area builtUpArea ,SUM(t.amount_owed) oweAmount,max(t.deadline_time)
  1031. deadlineTime
  1032. from report_owe_fee t
  1033. inner join pay_fee_config pfc on t.config_id = pfc.config_id and pfc.status_cd = '0'
  1034. left join building_room br on t.payer_obj_id = br.room_id and t.payer_obj_type = '3333' and br.status_cd = '0'
  1035. left join building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0'
  1036. left join f_floor f on bu.floor_id = f.floor_id and f.status_cd = '0'
  1037. inner join pay_fee pf on t.fee_id = pf.fee_id and pf.community_id = t.community_id and pf.status_cd = '0'
  1038. left join pay_fee_attrs pfa on pf.fee_id = pfa.fee_id and pfa.spec_cd = '390008' and pfa.status_cd ='0'
  1039. where 1=1
  1040. <if test="roomNum !=null and roomNum != ''">
  1041. and br.room_num= #{roomNum}
  1042. </if>
  1043. <if test="unitId !=null and unitId != ''">
  1044. and bu.unit_id= #{unitId}
  1045. </if>
  1046. <if test="floorId !=null and floorId != ''">
  1047. and f.floor_id = #{floorId}
  1048. </if>
  1049. <if test="objName !=null and objName != ''">
  1050. and t.payer_obj_name= #{objName}
  1051. </if>
  1052. <if test="feeId !=null and feeId != ''">
  1053. and t.fee_id= #{feeId}
  1054. </if>
  1055. <if test="configId !=null and configId != ''">
  1056. and t.config_id= #{configId}
  1057. </if>
  1058. <if test="objId !=null and objId != ''">
  1059. and t.payer_obj_id= #{objId}
  1060. </if>
  1061. <if test="feeName !=null and feeName != ''">
  1062. and t.fee_name= #{feeName}
  1063. </if>
  1064. <if test="communityId !=null and communityId != ''">
  1065. and t.community_id= #{communityId}
  1066. </if>
  1067. <if test="startTime !=null and startTime != ''">
  1068. and t.create_time &gt;= #{startTime}
  1069. </if>
  1070. <if test="endTime !=null and endTime != ''">
  1071. and t.create_time &lt;= #{endTime}
  1072. </if>
  1073. group by t.fee_name,t.payer_obj_id,t.payer_obj_name,pfa.`value`,br.built_up_area
  1074. HAVING oweAmount > 0
  1075. <if test="page != -1 and page != null ">
  1076. limit #{page}, #{row}
  1077. </if>
  1078. </select>
  1079. <!-- 查询费用月统计信息 add by wuxw 2018-07-03 -->
  1080. <select id="queryOweFeeDetailMajor" parameterType="Map" resultType="Map">
  1081. select SUM(t.amount_owed) oweAmount
  1082. from report_owe_fee t
  1083. inner join pay_fee_config pfc on t.config_id = pfc.config_id and pfc.status_cd = '0'
  1084. left join building_room br on t.payer_obj_id = br.room_id and t.payer_obj_type = '3333' and br.status_cd = '0'
  1085. left join building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0'
  1086. left join f_floor f on bu.floor_id = f.floor_id and f.status_cd = '0'
  1087. inner join pay_fee pf on t.fee_id = pf.fee_id and pf.community_id = t.community_id and pf.status_cd = '0'
  1088. where 1=1
  1089. <if test="roomNum !=null and roomNum != ''">
  1090. and br.room_num= #{roomNum}
  1091. </if>
  1092. <if test="unitId !=null and unitId != ''">
  1093. and bu.unit_id= #{unitId}
  1094. </if>
  1095. <if test="floorId !=null and floorId != ''">
  1096. and f.floor_id = #{floorId}
  1097. </if>
  1098. <if test="objName !=null and objName != ''">
  1099. and t.payer_obj_name= #{objName}
  1100. </if>
  1101. <if test="feeId !=null and feeId != ''">
  1102. and t.fee_id= #{feeId}
  1103. </if>
  1104. <if test="configId !=null and configId != ''">
  1105. and t.config_id= #{configId}
  1106. </if>
  1107. <if test="objId !=null and objId != ''">
  1108. and t.payer_obj_id= #{objId}
  1109. </if>
  1110. <if test="feeName !=null and feeName != ''">
  1111. and t.fee_name= #{feeName}
  1112. </if>
  1113. <if test="communityId !=null and communityId != ''">
  1114. and t.community_id= #{communityId}
  1115. </if>
  1116. <if test="startTime !=null and startTime != ''">
  1117. and t.create_time &gt;= #{startTime}
  1118. </if>
  1119. <if test="endTime !=null and endTime != ''">
  1120. and t.create_time &lt;= #{endTime}
  1121. </if>
  1122. </select>
  1123. <select id="queryPayFeeDetailCount" parameterType="Map" resultType="Map">
  1124. select count(1) count,SUM(receivedAmount) totalReceivedAmount,SUM(receivableAmount) totalReceivableAmount
  1125. from (
  1126. select pfc.fee_name feeName,f.floor_num floorNum,bu.unit_num unitNum,br.room_num roomNum,oc.car_num carNum,
  1127. pf.payer_obj_type payerObjType,t.start_time startTime,t.end_time endTime,t.create_time createTime,
  1128. t.receivable_amount receivableAmount,t.received_amount receivedAmount,d.name,d2.name feeTypeCdName,
  1129. pfc.fee_type_cd feeTypeCd,t.state,d3.name stateName
  1130. from pay_fee_detail t
  1131. INNER JOIN pay_fee pf on t.fee_id = pf.fee_id and pf.status_cd = '0'
  1132. inner join pay_fee_config pfc on pf.config_id = pfc.config_id and pfc.status_cd = '0'
  1133. left join building_room br on pf.payer_obj_id = br.room_id and pf.payer_obj_type = '3333' and br.status_cd = '0'
  1134. left join building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0'
  1135. left join f_floor f on bu.floor_id = f.floor_id and f.status_cd = '0'
  1136. left join owner_car oc on pf.payer_obj_id = oc.car_id and oc.car_type_cd='1001'
  1137. left join pay_fee_attrs pfa on t.fee_id = pfa.fee_id and pfa.spec_cd = '390002'
  1138. left join pay_fee_detail_discount pfdd on t.detail_id = pfdd.detail_id and pfdd.status_cd = '0'
  1139. left join fee_discount fd on pfdd.discount_id = fd.discount_id and fd.status_cd = '0'
  1140. left join fee_discount_rule fdr on fd.rule_id = fdr.rule_id and fdr.status_cd = '0'
  1141. left join t_dict d on t.prime_rate = d.status_cd and d.table_name="pay_fee_detail" and
  1142. d.table_columns="prime_rate"
  1143. left join t_dict d2 on pfc.fee_type_cd = d2.status_cd and d2.table_name = "pay_fee_config" and d2.table_columns
  1144. = "fee_type_cd"
  1145. left join t_dict d3 on t.state = d3.status_cd and d3.table_name = "pay_fee_detail" and d3.table_columns =
  1146. "state"
  1147. where t.status_cd = '0'
  1148. <if test="roomNum !=null and roomNum != ''">
  1149. and br.room_num= #{roomNum}
  1150. </if>
  1151. <if test="unitId !=null and unitId != ''">
  1152. and bu.unit_id= #{unitId}
  1153. </if>
  1154. <if test="floorId !=null and floorId != ''">
  1155. and f.floor_id = #{floorId}
  1156. </if>
  1157. <if test="objName !=null and objName != ''">
  1158. and t.obj_name= #{objName}
  1159. </if>
  1160. <if test="feeYear !=null and feeYear != ''">
  1161. and t.fee_year= #{feeYear}
  1162. </if>
  1163. <if test="feeMonth !=null and feeMonth != ''">
  1164. and t.fee_month= #{feeMonth}
  1165. </if>
  1166. <if test="feeId !=null and feeId != ''">
  1167. and t.fee_id= #{feeId}
  1168. </if>
  1169. <if test="configId !=null and configId != ''">
  1170. and pfc.config_id= #{configId}
  1171. </if>
  1172. <if test="objId !=null and objId != ''">
  1173. and pf.payer_obj_id= #{objId}
  1174. </if>
  1175. <if test="feeName !=null and feeName != ''">
  1176. and t.fee_name= #{feeName}
  1177. </if>
  1178. <if test="communityId !=null and communityId != ''">
  1179. and t.community_id= #{communityId}
  1180. </if>
  1181. <if test="primeRate != null and primeRate != ''">
  1182. and t.prime_rate = #{primeRate}
  1183. </if>
  1184. <if test="state != null and state != ''">
  1185. and t.state = #{state}
  1186. </if>
  1187. <if test="feeTypeCd != null and feeTypeCd != ''">
  1188. and pfc.fee_type_cd = #{feeTypeCd}
  1189. </if>
  1190. <if test="startTime !=null and startTime != ''">
  1191. and t.create_time &gt;= #{startTime}
  1192. </if>
  1193. <if test="endTime !=null and endTime != ''">
  1194. and t.create_time &lt;= #{endTime}
  1195. </if>
  1196. ) t
  1197. </select>
  1198. <!-- 查询费用月统计信息 add by wuxw 2018-07-03 -->
  1199. <select id="queryPayFeeDetail" parameterType="Map" resultType="Map">
  1200. select pfc.fee_name feeName,f.floor_num floorNum,bu.unit_num unitNum,br.room_num roomNum,oc.car_num carNum,
  1201. pf.payer_obj_type payerObjType,t.start_time startTime,t.end_time endTime,t.create_time createTime,
  1202. t.receivable_amount receivableAmount,t.received_amount receivedAmount,pfa.`value`
  1203. importFeeName,t.prime_rate,d.name primeRate,fdr.discount_small_type discountSmallType,fdr.rule_name
  1204. ruleName,pfdd.discount_price discountPrice,co.contract_code contractCode,pfo.`value` ownerName,cb.o_id oId,
  1205. d2.name feeTypeCdName,pfc.fee_type_cd feeTypeCd,t.state,d3.name stateName,t.fee_id feeId,pft.`value` repairId,
  1206. t.detail_id,t.detail_id detailId,pf.payer_obj_id
  1207. from pay_fee_detail t
  1208. INNER JOIN pay_fee pf on t.fee_id = pf.fee_id and pf.status_cd = '0'
  1209. inner join pay_fee_config pfc on pf.config_id = pfc.config_id and pfc.status_cd = '0'
  1210. left join building_room br on pf.payer_obj_id = br.room_id and pf.payer_obj_type = '3333' and br.status_cd = '0'
  1211. left join building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0'
  1212. left join f_floor f on bu.floor_id = f.floor_id and f.status_cd = '0'
  1213. left join owner_car oc on pf.payer_obj_id = oc.car_id and oc.car_type_cd='1001'
  1214. left join pay_fee_attrs pfa on t.fee_id = pfa.fee_id and pfa.spec_cd = '390002'
  1215. left join pay_fee_attrs pfo on t.fee_id = pfo.fee_id and pfo.spec_cd = '390008'
  1216. left join pay_fee_attrs pft on t.fee_id = pft.fee_id and pft.spec_cd = '390001'
  1217. left join pay_fee_detail_discount pfdd on t.detail_id = pfdd.detail_id and pfdd.status_cd = '0'
  1218. left join fee_discount fd on pfdd.discount_id = fd.discount_id and fd.status_cd = '0'
  1219. left join fee_discount_rule fdr on fd.rule_id = fdr.rule_id and fdr.status_cd = '0'
  1220. left join t_dict d on t.prime_rate = d.status_cd and d.table_name="pay_fee_detail" and
  1221. d.table_columns="prime_rate"
  1222. left join t_dict d2 on pfc.fee_type_cd = d2.status_cd and d2.table_name = "pay_fee_config" and d2.table_columns
  1223. = "fee_type_cd"
  1224. left join t_dict d3 on t.state = d3.status_cd and d3.table_name = "pay_fee_detail" and d3.table_columns =
  1225. "state"
  1226. LEFT JOIN contract co on pf.payer_obj_id = co.contract_id and co.status_cd = '0' and pf.payer_obj_type='7777'
  1227. LEFT JOIN c_business cb on t.b_id = cb.b_id
  1228. where t.status_cd = '0'
  1229. <if test="roomNum !=null and roomNum != ''">
  1230. and br.room_num= #{roomNum}
  1231. </if>
  1232. <if test="unitId !=null and unitId != ''">
  1233. and bu.unit_id= #{unitId}
  1234. </if>
  1235. <if test="floorId !=null and floorId != ''">
  1236. and f.floor_id = #{floorId}
  1237. </if>
  1238. <if test="objName !=null and objName != ''">
  1239. and t.obj_name= #{objName}
  1240. </if>
  1241. <if test="feeYear !=null and feeYear != ''">
  1242. and t.fee_year= #{feeYear}
  1243. </if>
  1244. <if test="feeMonth !=null and feeMonth != ''">
  1245. and t.fee_month= #{feeMonth}
  1246. </if>
  1247. <if test="feeId !=null and feeId != ''">
  1248. and t.fee_id= #{feeId}
  1249. </if>
  1250. <if test="configId !=null and configId != ''">
  1251. and pfc.config_id= #{configId}
  1252. </if>
  1253. <if test="objId !=null and objId != ''">
  1254. and pf.payer_obj_id = #{objId}
  1255. </if>
  1256. <if test="feeName !=null and feeName != ''">
  1257. and t.fee_name= #{feeName}
  1258. </if>
  1259. <if test="communityId !=null and communityId != ''">
  1260. and t.community_id= #{communityId}
  1261. </if>
  1262. <if test="primeRate != null and primeRate != ''">
  1263. and t.prime_rate = #{primeRate}
  1264. </if>
  1265. <if test="state != null and state != ''">
  1266. and t.state = #{state}
  1267. </if>
  1268. <if test="feeTypeCd != null and feeTypeCd != ''">
  1269. and pfc.fee_type_cd = #{feeTypeCd}
  1270. </if>
  1271. <if test="startTime !=null and startTime != ''">
  1272. and t.create_time &gt;= #{startTime}
  1273. </if>
  1274. <if test="endTime !=null and endTime != ''">
  1275. and t.create_time &lt;= #{endTime}
  1276. </if>
  1277. order by t.create_time desc
  1278. <if test="page != -1 and page != null ">
  1279. limit #{page}, #{row}
  1280. </if>
  1281. </select>
  1282. <select id="queryAllPayFeeDetail" parameterType="Map" resultType="Map">
  1283. select SUM(t.receivable_amount) allReceivableAmount,SUM(t.received_amount) allReceivedAmount
  1284. from pay_fee_detail t
  1285. INNER JOIN pay_fee pf on t.fee_id = pf.fee_id and pf.status_cd = '0'
  1286. inner join pay_fee_config pfc on pf.config_id = pfc.config_id and pfc.status_cd = '0'
  1287. left join building_room br on pf.payer_obj_id = br.room_id and pf.payer_obj_type = '3333' and br.status_cd = '0'
  1288. left join building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0'
  1289. left join f_floor f on bu.floor_id = f.floor_id and f.status_cd = '0'
  1290. left join owner_car oc on pf.payer_obj_id = oc.car_id and oc.status_cd = '0' and oc.car_type_cd='1001'
  1291. left join pay_fee_attrs pfa on t.fee_id = pfa.fee_id and pfa.spec_cd = '390002'
  1292. where t.status_cd = '0' and t.state not in ('1100','1300')
  1293. <if test="roomNum !=null and roomNum != ''">
  1294. and br.room_num= #{roomNum}
  1295. </if>
  1296. <if test="unitId !=null and unitId != ''">
  1297. and bu.unit_id= #{unitId}
  1298. </if>
  1299. <if test="floorId !=null and floorId != ''">
  1300. and f.floor_id = #{floorId}
  1301. </if>
  1302. <if test="objName !=null and objName != ''">
  1303. and t.obj_name= #{objName}
  1304. </if>
  1305. <if test="feeYear !=null and feeYear != ''">
  1306. and t.fee_year= #{feeYear}
  1307. </if>
  1308. <if test="feeMonth !=null and feeMonth != ''">
  1309. and t.fee_month= #{feeMonth}
  1310. </if>
  1311. <if test="feeId !=null and feeId != ''">
  1312. and t.fee_id= #{feeId}
  1313. </if>
  1314. <if test="configId !=null and configId != ''">
  1315. and pfc.config_id= #{configId}
  1316. </if>
  1317. <if test="objId !=null and objId != ''">
  1318. and pf.payer_obj_id= #{objId}
  1319. </if>
  1320. <if test="feeName !=null and feeName != ''">
  1321. and t.fee_name= #{feeName}
  1322. </if>
  1323. <if test="communityId !=null and communityId != ''">
  1324. and t.community_id= #{communityId}
  1325. </if>
  1326. <if test="primeRate != null and primeRate != ''">
  1327. and t.prime_rate = #{primeRate}
  1328. </if>
  1329. <if test="startTime !=null and startTime != ''">
  1330. and t.create_time &gt;= #{startTime}
  1331. </if>
  1332. <if test="endTime !=null and endTime != ''">
  1333. and t.create_time &lt;= #{endTime}
  1334. </if>
  1335. </select>
  1336. <select id="queryPayFeeDetailSum" parameterType="Map" resultType="Map">
  1337. select pfc.fee_name feeName,f.floor_num floorNum,bu.unit_num unitNum,br.room_num roomNum,oc.car_num carNum,
  1338. pf.payer_obj_type payerObjType,t.start_time startTime,t.end_time endTime,t.create_time createTime,
  1339. t.receivable_amount receivableAmount,t.received_amount receivedAmount,pfa.`value`
  1340. importFeeName,t.prime_rate,d.name primeRate,fdr.discount_small_type discountSmallType,fdr.rule_name
  1341. ruleName,pfdd.discount_price,
  1342. SUM(pfdd.discount_price) discountPrice
  1343. from pay_fee_detail t
  1344. INNER JOIN pay_fee pf on t.fee_id = pf.fee_id and pf.status_cd = '0'
  1345. inner join pay_fee_config pfc on pf.config_id = pfc.config_id and pfc.status_cd = '0'
  1346. left join building_room br on pf.payer_obj_id = br.room_id and pf.payer_obj_type = '3333' and br.status_cd = '0'
  1347. left join building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0'
  1348. left join f_floor f on bu.floor_id = f.floor_id and f.status_cd = '0'
  1349. left join owner_car oc on pf.payer_obj_id = oc.car_id and oc.status_cd = '0' and oc.car_type_cd='1001'
  1350. left join pay_fee_attrs pfa on t.fee_id = pfa.fee_id and pfa.spec_cd = '390002'
  1351. left join pay_fee_detail_discount pfdd on t.detail_id = pfdd.detail_id and pfdd.status_cd = '0'
  1352. left join fee_discount fd on pfdd.discount_id = fd.discount_id and fd.status_cd = '0'
  1353. left join fee_discount_rule fdr on fd.rule_id = fdr.rule_id and fdr.status_cd = '0'
  1354. left join t_dict d on t.prime_rate = d.status_cd and d.table_name="pay_fee_detail" and
  1355. d.table_columns="prime_rate"
  1356. where t.status_cd = '0' and t.state not in ('1100','1300')
  1357. <if test="roomNum !=null and roomNum != ''">
  1358. and br.room_num= #{roomNum}
  1359. </if>
  1360. <if test="unitId !=null and unitId != ''">
  1361. and bu.unit_id= #{unitId}
  1362. </if>
  1363. <if test="floorId !=null and floorId != ''">
  1364. and f.floor_id = #{floorId}
  1365. </if>
  1366. <if test="objName !=null and objName != ''">
  1367. and t.obj_name= #{objName}
  1368. </if>
  1369. <if test="feeYear !=null and feeYear != ''">
  1370. and t.fee_year= #{feeYear}
  1371. </if>
  1372. <if test="feeMonth !=null and feeMonth != ''">
  1373. and t.fee_month= #{feeMonth}
  1374. </if>
  1375. <if test="feeId !=null and feeId != ''">
  1376. and t.fee_id= #{feeId}
  1377. </if>
  1378. <if test="configId !=null and configId != ''">
  1379. and pfc.config_id= #{configId}
  1380. </if>
  1381. <if test="objId !=null and objId != ''">
  1382. and pf.payer_obj_id= #{objId}
  1383. </if>
  1384. <if test="feeName !=null and feeName != ''">
  1385. and t.fee_name= #{feeName}
  1386. </if>
  1387. <if test="communityId !=null and communityId != ''">
  1388. and t.community_id= #{communityId}
  1389. </if>
  1390. <if test="primeRate != null and primeRate != ''">
  1391. and t.prime_rate = #{primeRate}
  1392. </if>
  1393. <if test="startTime !=null and startTime != ''">
  1394. and t.create_time &gt;= #{startTime}
  1395. </if>
  1396. <if test="endTime !=null and endTime != ''">
  1397. and t.create_time &lt;= #{endTime}
  1398. </if>
  1399. group by fdr.discount_small_type
  1400. order by t.create_time desc
  1401. </select>
  1402. <select id="queryDeadlineFeeCount" parameterType="Map" resultType="Map">
  1403. select count(1) count
  1404. from (
  1405. SELECT
  1406. t.obj_name objName,
  1407. t.fee_name feeName,
  1408. t.deadline_time deadlineTime
  1409. FROM
  1410. report_fee_month_statistics t
  1411. inner join pay_fee_config pfc on t.config_id = pfc.config_id and pfc.status_cd = '0'
  1412. left join building_room br on t.obj_id = br.room_id and t.obj_type = '3333' and br.status_cd = '0'
  1413. left join building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0'
  1414. left join f_floor f on bu.floor_id = f.floor_id and f.status_cd = '0'
  1415. inner join pay_fee pf on t.fee_id = pf.fee_id and pf.community_id = t.community_id and pf.status_cd = '0'
  1416. where t.status_cd = '0'
  1417. <if test="roomNum !=null and roomNum != ''">
  1418. and br.room_num= #{roomNum}
  1419. </if>
  1420. <if test="unitId !=null and unitId != ''">
  1421. and bu.unit_id= #{unitId}
  1422. </if>
  1423. <if test="floorId !=null and floorId != ''">
  1424. and f.floor_id = #{floorId}
  1425. </if>
  1426. <if test="objName !=null and objName != ''">
  1427. and t.obj_name= #{objName}
  1428. </if>
  1429. <if test="feeYear !=null and feeYear != ''">
  1430. and t.fee_year= #{feeYear}
  1431. </if>
  1432. <if test="feeMonth !=null and feeMonth != ''">
  1433. and t.fee_month= #{feeMonth}
  1434. </if>
  1435. <if test="feeId !=null and feeId != ''">
  1436. and t.fee_id= #{feeId}
  1437. </if>
  1438. <if test="configId !=null and configId != ''">
  1439. and t.config_id= #{configId}
  1440. </if>
  1441. <if test="objId !=null and objId != ''">
  1442. and t.obj_id= #{objId}
  1443. </if>
  1444. <if test="feeName !=null and feeName != ''">
  1445. and t.fee_name= #{feeName}
  1446. </if>
  1447. <if test="communityId !=null and communityId != ''">
  1448. and t.community_id= #{communityId}
  1449. </if>
  1450. <if test="startTime !=null and startTime != ''">
  1451. and t.deadline_time &gt;= #{startTime}
  1452. </if>
  1453. <if test="endTime !=null and endTime != ''">
  1454. and t.deadline_time &lt;= #{endTime}
  1455. </if>
  1456. ) t
  1457. </select>
  1458. <!-- 查询费用月统计信息 add by wuxw 2018-07-03 -->
  1459. <select id="queryDeadlineFee" parameterType="Map" resultType="Map">
  1460. SELECT
  1461. t.obj_name objName,
  1462. t.fee_name feeName,
  1463. t.deadline_time deadlineTime
  1464. FROM
  1465. report_fee_month_statistics t
  1466. inner join pay_fee_config pfc on t.config_id = pfc.config_id and pfc.status_cd = '0'
  1467. left join building_room br on t.obj_id = br.room_id and t.obj_type = '3333' and br.status_cd = '0'
  1468. left join building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0'
  1469. left join f_floor f on bu.floor_id = f.floor_id and f.status_cd = '0'
  1470. inner join pay_fee pf on t.fee_id = pf.fee_id and pf.community_id = t.community_id and pf.status_cd = '0'
  1471. where t.status_cd = '0'
  1472. <if test="roomNum !=null and roomNum != ''">
  1473. and br.room_num= #{roomNum}
  1474. </if>
  1475. <if test="unitId !=null and unitId != ''">
  1476. and bu.unit_id= #{unitId}
  1477. </if>
  1478. <if test="floorId !=null and floorId != ''">
  1479. and f.floor_id = #{floorId}
  1480. </if>
  1481. <if test="objName !=null and objName != ''">
  1482. and t.obj_name= #{objName}
  1483. </if>
  1484. <if test="feeYear !=null and feeYear != ''">
  1485. and t.fee_year= #{feeYear}
  1486. </if>
  1487. <if test="feeMonth !=null and feeMonth != ''">
  1488. and t.fee_month= #{feeMonth}
  1489. </if>
  1490. <if test="feeId !=null and feeId != ''">
  1491. and t.fee_id= #{feeId}
  1492. </if>
  1493. <if test="configId !=null and configId != ''">
  1494. and t.config_id= #{configId}
  1495. </if>
  1496. <if test="objId !=null and objId != ''">
  1497. and t.obj_id= #{objId}
  1498. </if>
  1499. <if test="feeName !=null and feeName != ''">
  1500. and t.fee_name= #{feeName}
  1501. </if>
  1502. <if test="communityId !=null and communityId != ''">
  1503. and t.community_id= #{communityId}
  1504. </if>
  1505. <if test="startTime !=null and startTime !=''">
  1506. and t.deadline_time &gt;= #{startTime}
  1507. </if>
  1508. <if test="endTime !=null and endTime != ''">
  1509. and t.deadline_time &lt;= #{endTime}
  1510. </if>
  1511. order by t.deadline_time
  1512. <if test="page != -1 and page != null ">
  1513. limit #{page}, #{row}
  1514. </if>
  1515. </select>
  1516. <select id="queryPrePaymentNewCount" parameterType="Map" resultType="Map">
  1517. select count(1) count
  1518. from (
  1519. select pfc.fee_name feeName, f.floor_num floorNum,bu.unit_num unitNum,br.room_num roomNum,t.end_time endTime
  1520. ,oc.car_num carNum
  1521. from pay_fee t
  1522. inner join pay_fee_config pfc on t.config_id = pfc.config_id and pfc.status_cd = '0'
  1523. left join building_room br on t.payer_obj_id = br.room_id and t.payer_obj_type = '3333' and br.status_cd = '0'
  1524. left join building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0'
  1525. left join f_floor f on f.floor_id = bu.floor_id and f.status_cd = '0'
  1526. 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
  1527. oc.car_type_cd='1001'
  1528. where t.state = '2008001'
  1529. and t.status_cd = '0'
  1530. <if test="communityId !=null and communityId != ''">
  1531. and t.community_id= #{communityId}
  1532. </if>
  1533. <if test="startTime !=null and startTime != ''">
  1534. and t.end_time &gt;= #{startTime}
  1535. </if>
  1536. <if test="endTime !=null and endTime != ''">
  1537. and t.end_time &lt;= #{endTime}
  1538. </if>
  1539. ) t
  1540. </select>
  1541. <!-- 查询费用月统计信息 add by wuxw 2018-07-03 -->
  1542. <select id="queryPrePayment" parameterType="Map" resultType="Map">
  1543. select pfc.fee_name feeName, f.floor_num floorNum,bu.unit_num unitNum,br.room_num roomNum,t.end_time endTime ,
  1544. oc.car_num carNum,t.payer_obj_type payerObjType
  1545. from pay_fee t
  1546. inner join pay_fee_config pfc on t.config_id = pfc.config_id and pfc.status_cd = '0'
  1547. left join building_room br on t.payer_obj_id = br.room_id and t.payer_obj_type = '3333' and br.status_cd = '0'
  1548. left join building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0'
  1549. left join f_floor f on f.floor_id = bu.floor_id and f.status_cd = '0'
  1550. 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
  1551. oc.car_type_cd='1001'
  1552. where t.state = '2008001'
  1553. and t.status_cd = '0'
  1554. <if test="communityId !=null and communityId != ''">
  1555. and t.community_id= #{communityId}
  1556. </if>
  1557. <if test="startTime !=null and startTime != ''">
  1558. and t.end_time &gt;= #{startTime}
  1559. </if>
  1560. <if test="endTime !=null and endTime != ''">
  1561. and t.end_time &lt;= #{endTime}
  1562. </if>
  1563. <if test="page != -1 and page != null ">
  1564. limit #{page}, #{row}
  1565. </if>
  1566. </select>
  1567. <select id="queryPrePaymentCount" parameterType="Map" resultType="Map">
  1568. select pfc.fee_name feeName,count(t.payer_obj_id) objCount from pay_fee t
  1569. inner join pay_fee_config pfc on t.config_id = pfc.config_id and pfc.status_cd = '0'
  1570. where t.state = '2008001'
  1571. and t.status_cd = '0'
  1572. and t.end_time &gt; #{startTime}
  1573. and t.end_time &lt; #{endTime}
  1574. and t.community_id= #{communityId}
  1575. group by pfc.fee_name ,pfc.config_id
  1576. order by objCount
  1577. </select>
  1578. <select id="queryDeadlinePaymentCount" parameterType="Map" resultType="Map">
  1579. SELECT
  1580. t.fee_name feeName,
  1581. count(t.obj_id) objCount
  1582. FROM
  1583. report_fee_month_statistics t
  1584. inner join pay_fee pf on t.fee_id = pf.fee_id and pf.community_id = t.community_id and pf.status_cd = '0'
  1585. WHERE
  1586. 1 = 1
  1587. AND t.status_cd = '0'
  1588. and t.community_id= #{communityId}
  1589. AND t.deadline_time &gt; #{startTime}
  1590. AND t.deadline_time &lt; #{endTime}
  1591. group by t.config_id,t.fee_name
  1592. order by objCount desc
  1593. </select>
  1594. <select id="queryOwePaymentCount" parameterType="Map" resultType="Map">
  1595. select t.fee_name feeName,count( distinct t.obj_id) objCount
  1596. from report_fee_month_statistics t
  1597. inner join pay_fee pf on t.fee_id = pf.fee_id and pf.community_id = t.community_id and pf.status_cd = '0'
  1598. where t.community_id = #{communityId}
  1599. and t.owe_amount > 0
  1600. group by t.config_id,t.fee_name
  1601. order by objCount desc
  1602. </select>
  1603. <select id="queryAllPaymentCount" parameterType="Map" resultType="Map">
  1604. select t.fee_name feeName,count(distinct t.obj_id) objCount
  1605. from report_fee_month_statistics t
  1606. inner join pay_fee pf on t.fee_id = pf.fee_id and pf.community_id = t.community_id and pf.status_cd = '0'
  1607. where t.community_id = #{communityId}
  1608. group by t.config_id,t.fee_name
  1609. order by objCount desc
  1610. </select>
  1611. <select id="queryFinishOweFee" parameterType="Map" resultType="Map">
  1612. select t.config_id configId, t.fee_id feeId,t.statistics_id statisticsId,t.fee_year feeYear,fee_month feeMonth
  1613. from report_fee_month_statistics t
  1614. inner join pay_fee pf on t.fee_id = pf.fee_id and pf.state = '2009001' and pf.community_id = #{communityId} and
  1615. pf.status_cd = '0'
  1616. where t.owe_amount > 0
  1617. and t.status_cd = '0'
  1618. and t.community_id = #{communityId}
  1619. limit 100
  1620. </select>
  1621. <!-- 查询费用配置信息 add by wuxw 2018-07-03 -->
  1622. <select id="getFeeConfigInfo" parameterType="Map" resultType="Map">
  1623. select t.fee_type_cd,t.fee_type_cd feeTypeCd,t.computing_formula,t.computing_formula
  1624. computingFormula,t.additional_amount,t.additional_amount additionalAmount,t.status_cd,t.status_cd
  1625. statusCd,t.square_price,t.square_price squarePrice,t.is_default,t.is_default isDefault,t.config_id,t.config_id
  1626. configId,t.fee_flag,t.fee_flag feeFlag,t.fee_name,t.fee_name feeName,t.start_time,t.start_time
  1627. startTime,t.end_time,t.end_time endTime,t.community_id,t.community_id communityId,t.b_id,t.b_id bId,
  1628. td1.name feeTypeCdName,td2.name feeFlagName,t.bill_type billType,t.bill_type,td3.name billTypeName,
  1629. t.payment_cd,t.payment_cycle,t.payment_cd paymentCd,t.payment_cycle paymentCycle
  1630. from pay_fee_config t,t_dict td1,t_dict td2,t_dict td3
  1631. where 1 =1
  1632. and t.fee_type_cd = td1.status_cd
  1633. and td1.table_name = 'pay_fee_config'
  1634. and td1.table_columns = 'fee_type_cd'
  1635. and t.fee_flag = td2.status_cd
  1636. and td2.table_name = 'pay_fee_config'
  1637. and td2.table_columns = 'fee_flag'
  1638. and t.bill_type = td3.status_cd
  1639. and td3.table_name = 'pay_fee_config'
  1640. and td3.table_columns = 'bill_type'
  1641. and t.is_default = 'F'
  1642. and t.status_cd = '0'
  1643. <if test="feeTypeCd !=null and feeTypeCd != ''">
  1644. and t.fee_type_cd= #{feeTypeCd}
  1645. </if>
  1646. <if test="computingFormula !=null and computingFormula != ''">
  1647. and t.computing_formula= #{computingFormula}
  1648. </if>
  1649. <if test="additionalAmount !=null and additionalAmount != ''">
  1650. and t.additional_amount= #{additionalAmount}
  1651. </if>
  1652. <if test="squarePrice !=null and squarePrice != ''">
  1653. and t.square_price= #{squarePrice}
  1654. </if>
  1655. <if test="configId !=null and configId != ''">
  1656. and t.config_id= #{configId}
  1657. </if>
  1658. <if test="feeFlag !=null and feeFlag != ''">
  1659. and t.fee_flag= #{feeFlag}
  1660. </if>
  1661. <if test="feeName !=null and feeName != ''">
  1662. and t.fee_name like '%${feeName}%'
  1663. </if>
  1664. <if test="startTime !=null ">
  1665. and t.start_time= #{startTime}
  1666. </if>
  1667. <if test="endTime !=null ">
  1668. and t.end_time= #{endTime}
  1669. </if>
  1670. <if test="valid !=null and valid == 1">
  1671. and t.end_time &gt; now()
  1672. </if>
  1673. <if test="curTime !=null ">
  1674. and t.end_time &gt; #{curTime}
  1675. and t.start_time &lt; #{curTime}
  1676. </if>
  1677. <if test="communityId !=null and communityId != ''">
  1678. and t.community_id= #{communityId}
  1679. </if>
  1680. <if test="bId !=null and bId != ''">
  1681. and t.b_id= #{bId}
  1682. </if>
  1683. <if test="paymentCd !=null and paymentCd != ''">
  1684. and t.payment_cd= #{paymentCd}
  1685. </if>
  1686. <if test="paymentCycle !=null and paymentCycle != ''">
  1687. and t.payment_cycle= #{paymentCycle}
  1688. </if>
  1689. <if test="billType !=null and billType != ''">
  1690. and t.bill_type= #{billType}
  1691. </if>
  1692. order by t.create_time desc
  1693. <if test="page != -1 and page != null ">
  1694. limit #{page}, #{row}
  1695. </if>
  1696. </select>
  1697. <select id="getRepairInfo" parameterType="Map" resultType="Map">
  1698. select r.staff_id staffId,r.staff_name staffName,r.state, t.name stateName, count(*) amount from r_repair_user r
  1699. left join t_dict t on t.table_name="r_repair_user" and t.table_columns="state" and t.status_cd=r.state
  1700. where r.state != "10005" and r.status_cd = "0"
  1701. <if test="ruId != null and ruId != ''">
  1702. and r.ru_id = #{ruId}
  1703. </if>
  1704. <if test="repairId != null and repairId != ''">
  1705. and r.repair_id = #{repairId}
  1706. </if>
  1707. <if test="communityId != null and communityId !=''">
  1708. and r.community_id = #{communityId}
  1709. </if>
  1710. <if test="bId != null and bId !=''">
  1711. and r.b_id = #{bId}
  1712. </if>
  1713. <if test="state != null and state != ''">
  1714. and r.state = #{state}
  1715. </if>
  1716. <if test="context != null and context !=''">
  1717. and r.context = #{context}
  1718. </if>
  1719. <if test="statusCd != null and statusCd != ''">
  1720. and r.status_cd = #{statusCd}
  1721. </if>
  1722. <if test="staffId != null and staffId !=''">
  1723. and r.staff_id = #{staffId}
  1724. </if>
  1725. <if test="staffName != null and staffName !=''">
  1726. and r.staff_name = #{staffName}
  1727. </if>
  1728. <if test="preStaffId != null and preStaffId !=''">
  1729. and r.pre_staff_id = #{preStaffId}
  1730. </if>
  1731. <if test="preStaffName != null and preStaffName !=''">
  1732. and r.pre_staff_name = #{preStaffName}
  1733. </if>
  1734. <if test="beginStartTime != null and beginStartTime !=''">
  1735. and r.start_time &gt;= #{beginStartTime}
  1736. </if>
  1737. <if test="beginEndTime != null and beginEndTime !=''">
  1738. and r.start_time &lt;= #{beginEndTime}
  1739. </if>
  1740. <if test="finishStartTime != null and finishStartTime !=''">
  1741. and r.end_time &gt;= #{finishStartTime}
  1742. </if>
  1743. <if test="finishEndTime != null and finishEndTime !=''">
  1744. and r.end_time &lt;= #{finishEndTime}
  1745. </if>
  1746. <if test="createTime != null and createTime !=''">
  1747. and r.create_time = #{createTime}
  1748. </if>
  1749. group by r.staff_id,r.state
  1750. order by r.create_time desc
  1751. <if test="page != -1 and page != null ">
  1752. limit #{page}, #{row}
  1753. </if>
  1754. </select>
  1755. <select id="getRepairWithOutPage" parameterType="Map" resultType="Map">
  1756. select r.staff_id staffId,r.staff_name staffName,r.state, t.name stateName,u.score, count(*) amount from
  1757. r_repair_user r
  1758. left join t_dict t on t.table_name="r_repair_user" and t.table_columns="state" and t.status_cd=r.state
  1759. left join u_user u on u.user_id = r.staff_id and u.status_cd = '0'
  1760. where r.state != '10005' and r.status_cd = '0'
  1761. <if test="ruId != null and ruId != ''">
  1762. and r.ru_id = #{ruId}
  1763. </if>
  1764. <if test="repairId != null and repairId != ''">
  1765. and r.repair_id = #{repairId}
  1766. </if>
  1767. <if test="communityId != null and communityId !=''">
  1768. and r.community_id = #{communityId}
  1769. </if>
  1770. <if test="bId != null and bId !=''">
  1771. and r.b_id = #{bId}
  1772. </if>
  1773. <if test="state != null and state != ''">
  1774. and r.state = #{state}
  1775. </if>
  1776. <if test="context != null and context !=''">
  1777. and r.context = #{context}
  1778. </if>
  1779. <if test="statusCd != null and statusCd != ''">
  1780. and r.status_cd = #{statusCd}
  1781. </if>
  1782. <if test="staffId != null and staffId !=''">
  1783. and r.staff_id = #{staffId}
  1784. </if>
  1785. <if test="staffName != null and staffName !=''">
  1786. and r.staff_name = #{staffName}
  1787. </if>
  1788. <if test="preStaffId != null and preStaffId !=''">
  1789. and r.pre_staff_id = #{preStaffId}
  1790. </if>
  1791. <if test="preStaffName != null and preStaffName !=''">
  1792. and r.pre_staff_name = #{preStaffName}
  1793. </if>
  1794. <if test="beginStartTime != null and beginStartTime !=''">
  1795. and r.start_time &gt;= #{beginStartTime}
  1796. </if>
  1797. <if test="beginEndTime != null and beginEndTime !=''">
  1798. and r.start_time &lt;= #{beginEndTime}
  1799. </if>
  1800. <if test="finishStartTime != null and finishStartTime !=''">
  1801. and r.end_time &gt;= #{finishStartTime}
  1802. </if>
  1803. <if test="finishEndTime != null and finishEndTime !=''">
  1804. and r.end_time &lt;= #{finishEndTime}
  1805. </if>
  1806. <if test="createTime != null and createTime !=''">
  1807. and r.create_time = #{createTime}
  1808. </if>
  1809. group by r.staff_id,r.state
  1810. order by r.create_time desc
  1811. </select>
  1812. <select id="queryRepairForStaff" parameterType="Map" resultType="Map">
  1813. SELECT r.staff_id staffId,r.staff_name staffName,r.state FROM r_repair_user r
  1814. WHERE r.state!='10005' AND r.state!='10009' AND r.state!='11000' AND
  1815. r.state!='12000' AND r.state != '10007' AND r.status_cd = '0' AND
  1816. r.repair_event != 'payUser' AND r.repair_event != 'startUser' AND r.staff_id != '-1'
  1817. <if test="communityId != null and communityId !=''">
  1818. and r.community_id = #{communityId}
  1819. </if>
  1820. <if test="staffId != null and staffId != ''">
  1821. and r.staff_id = #{staffId}
  1822. </if>
  1823. group by r.staff_id
  1824. order by r.create_time desc
  1825. <if test="page != -1 and page != null ">
  1826. limit #{page}, #{row}
  1827. </if>
  1828. </select>
  1829. <select id="getReceivableInformation" parameterType="Map" resultType="Map">
  1830. select sum(t.receivable_amount) receivableAmount,SUM(t.received_amount) receivedAmount,SUM(t.owe_amount)
  1831. oweAmount
  1832. from report_fee_month_statistics t
  1833. inner join pay_fee pf on t.fee_id = pf.fee_id and pf.status_cd = '0'
  1834. where t.community_id = #{communityId}
  1835. </select>
  1836. <select id="getFloorReceivableInformation" parameterType="Map" resultType="Map">
  1837. select f.floor_num floorNum,f.`name`,sum(t.receivable_amount) receivableAmount,SUM(t.received_amount)
  1838. receivedAmount,SUM(t.owe_amount) oweAmount
  1839. from report_fee_month_statistics t
  1840. inner join pay_fee pf on t.fee_id = pf.fee_id and pf.status_cd = '0'
  1841. inner join building_room br on br.room_id = t.obj_id and t.obj_type = '3333' and br.community_id =
  1842. t.community_id and br.status_cd = '0'
  1843. inner join building_unit bu on bu.unit_id = br.unit_id and bu.status_cd = '0'
  1844. inner join f_floor f on f.floor_id = bu.floor_id and f.status_cd = '0'
  1845. where t.community_id = #{communityId}
  1846. group by f.floor_num ,f.`name`
  1847. </select>
  1848. <select id="getFeeConfigReceivableInformation" parameterType="Map" resultType="Map">
  1849. select t.fee_name feeName,sum(t.receivable_amount) receivableAmount,SUM(t.received_amount)
  1850. receivedAmount,SUM(t.owe_amount) oweAmount
  1851. from report_fee_month_statistics t
  1852. inner join pay_fee pf on t.fee_id = pf.fee_id and pf.status_cd = '0'
  1853. where t.community_id = #{communityId}
  1854. group by t.fee_name
  1855. </select>
  1856. <!-- 查询未收费房屋统计数量 add by wuxw 2018-07-03 -->
  1857. <select id="queryNoFeeRoomsCount" parameterType="Map" resultType="Map">
  1858. select count(1) count
  1859. from building_room t
  1860. inner join building_unit bu on t.unit_id = bu.unit_id and bu.status_cd = '0'
  1861. inner join f_floor f on bu.floor_id = f.floor_id and f.status_cd = '0'
  1862. where t.status_cd = '0'
  1863. and not exists(
  1864. select 1 from pay_fee pf where t.room_id = pf.payer_obj_id and pf.status_cd = '0' and pf.state = '2008001'
  1865. )
  1866. and t.community_id = #{communityId}
  1867. </select>
  1868. <!-- 查询费用月统计信息 add by wuxw 2018-07-03 -->
  1869. <select id="queryNoFeeRooms" parameterType="Map" resultType="Map">
  1870. select f.floor_num floorNum,bu.unit_num unitNum,t.room_num roomNum,t.room_id roomId,bo.owner_id ownerId,bo.name
  1871. ownerName,bo.link
  1872. from building_room t
  1873. inner join building_unit bu on t.unit_id = bu.unit_id and bu.status_cd = '0'
  1874. inner join f_floor f on bu.floor_id = f.floor_id and f.status_cd = '0'
  1875. left join building_owner_room_rel borr on borr.room_id = t.room_id and borr.status_cd ='0'
  1876. left join building_owner bo on borr.owner_id = bo.member_id and bo.status_cd = '0'
  1877. where t.status_cd = '0'
  1878. and not exists(
  1879. select 1 from pay_fee pf where t.room_id = pf.payer_obj_id and pf.status_cd = '0' and pf.state = '2008001'
  1880. )
  1881. and t.community_id = #{communityId}
  1882. order by t.create_time desc
  1883. <if test="page != -1 and page != null ">
  1884. limit #{page}, #{row}
  1885. </if>
  1886. </select>
  1887. <!-- 查询押金 -->
  1888. <select id="queryPayFeeDeposit" parameterType="Map" resultType="Map">
  1889. select t.amount,t.income_obj_id,t.income_obj_id incomeObjId,t.fee_type_cd,t.fee_type_cd
  1890. feeTypeCd,t.start_time,t.start_time startTime,t.status_cd,t.status_cd statusCd,t.end_time,t.end_time
  1891. endTime,t.community_id,t.community_id communityId,t.b_id,t.b_id bId,t.fee_id,t.fee_id feeId,t.user_id,t.user_id
  1892. userId,t.payer_obj_id,t.payer_obj_id payerObjId,pfc.square_price squarePrice,pfc.additional_amount
  1893. additionalAmount,t.fee_flag,t.fee_flag feeFlag,t.state,t.config_id,t.config_id configId,
  1894. pfc.fee_name feeName,td1.name feeTypeCdName,td2.name stateName,td3.name feeFlagName,pfc.computing_formula
  1895. computingFormula,pfc.computing_formula_text computingFormulaText,
  1896. pfc.bill_type billType,t.payer_obj_type,t.payer_obj_type payerObjType,pfc.is_default isDefault,pfc.start_time
  1897. configStartTime,pfc.end_time configEndTime,pfc.payment_cd paymentCd,pfc.payment_cycle paymentCycle,td4.name
  1898. billTypeName,t.create_time createTime,td5.name payerObjTypeName,pfd.state detailState,td6.name
  1899. detailStateName,pfa1.`value` deadlineTime
  1900. ,pfo.`value` ownerName,f.floor_num floorNum,bu.unit_num unitNum,br.room_num roomNum,oc.car_num carNum
  1901. from pay_fee t
  1902. INNER join pay_fee_config pfc on t.config_id = pfc.config_id and pfc.status_cd = '0' and pfc.fee_type_cd =
  1903. '888800010006'
  1904. left join pay_fee_detail pfd on t.fee_id = pfd.fee_id and pfd.status_cd = '0' and pfd.state != '1300'
  1905. left join t_dict td1 on pfc.fee_type_cd = td1.status_cd and td1.table_name = 'pay_fee_config' and
  1906. td1.table_columns = 'fee_type_cd'
  1907. left join t_dict td2 on t.state = td2.status_cd and td2.table_name = 'pay_fee' and td2.table_columns = 'state'
  1908. left join t_dict td3 on t.fee_flag = td3.status_cd and td3.table_name = 'pay_fee' and td3.table_columns =
  1909. 'fee_flag'
  1910. left join t_dict td4 on pfc.bill_type = td4.status_cd and td4.table_name = 'pay_fee_config' and
  1911. td4.table_columns = 'bill_type'
  1912. left join t_dict td5 on t.payer_obj_type = td5.status_cd and td5.table_name = 'pay_fee' and
  1913. td5.table_columns = 'payer_obj_type'
  1914. left join t_dict td6 on pfd.state = td6.status_cd and td6.table_name = 'pay_fee_detail' and
  1915. td6.table_columns = 'state'
  1916. left join pay_fee_attrs pfo on t.fee_id = pfo.fee_id and pfo.spec_cd = '390008'
  1917. LEFT JOIN pay_fee_attrs pfa1 on t.fee_id = pfa1.fee_id and pfa1.spec_cd = '390010' and pfa1.status_cd = '0'
  1918. left join building_room br on t.payer_obj_id = br.room_id and t.payer_obj_type = '3333' and br.status_cd = '0'
  1919. left join building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0'
  1920. left join f_floor f on bu.floor_id = f.floor_id and f.status_cd = '0'
  1921. left join owner_car oc on t.payer_obj_id = oc.car_id and oc.car_type_cd='1001'
  1922. where 1 = 1
  1923. <if test="roomNum !=null and roomNum != ''">
  1924. and br.room_num= #{roomNum}
  1925. </if>
  1926. <if test="unitId !=null and unitId != ''">
  1927. and bu.unit_id= #{unitId}
  1928. </if>
  1929. <if test="floorId !=null and floorId != ''">
  1930. and f.floor_id = #{floorId}
  1931. </if>
  1932. <if test="amount != null and amount != ''">
  1933. and t.amount = #{amount}
  1934. </if>
  1935. <if test="incomeObjId != null and incomeObjId != ''">
  1936. and t.income_obj_id = #{incomeObjId}
  1937. </if>
  1938. <if test="feeTypeCd != null and feeTypeCd != ''">
  1939. and t.fee_type_cd = #{feeTypeCd}
  1940. </if>
  1941. <if test="startTime != null and startTime != ''">
  1942. and t.start_time = #{startTime}
  1943. </if>
  1944. <if test="endTime != null and endTime != ''">
  1945. and t.end_time = #{endTime}
  1946. </if>
  1947. <if test="statusCd != null and statusCd != ''">
  1948. and t.status_cd = #{statusCd}
  1949. </if>
  1950. <if test="communityId != null and communityId != ''">
  1951. and t.community_id = #{communityId}
  1952. </if>
  1953. <if test="feeId != null and feeId != ''">
  1954. and t.fee_id = #{feeId}
  1955. </if>
  1956. <if test="userId != null and userId != ''">
  1957. and t.user_id = #{userId}
  1958. </if>
  1959. <if test="payerObjId != null and payerObjId != ''">
  1960. and t.payer_obj_id = #{payerObjId}
  1961. </if>
  1962. <if test="squarePrice != null and squarePrice != ''">
  1963. and pfc.square_price = #{squarePrice}
  1964. </if>
  1965. <if test="additionalAmount != null and additionalAmount != ''">
  1966. and pfc.additional_amount = #{additionalAmount}
  1967. </if>
  1968. <if test="feeFlag != null and feeFlag != ''">
  1969. and t.fee_flag = #{feeFlag}
  1970. </if>
  1971. <if test="state != null and state != ''">
  1972. and t.state = #{state}
  1973. </if>
  1974. <if test="configId != null and configId != ''">
  1975. and t.config_id = #{configId}
  1976. </if>
  1977. <if test="feeName != null and feeName != ''">
  1978. and pfc.fee_name = #{feeName}
  1979. </if>
  1980. <if test="computingFormula != null and computingFormula != ''">
  1981. and pfc.computing_formula = #{computingFormula}
  1982. </if>
  1983. <if test="computingFormulaText != null and computingFormulaText != ''">
  1984. and pfc.computing_formula_text = #{computingFormulaText}
  1985. </if>
  1986. <if test="billType != null and billType != ''">
  1987. and pfc.bill_type = #{billType}
  1988. </if>
  1989. <if test="payerObjType != null and payerObjType != ''">
  1990. and t.payer_obj_type = #{payerObjType}
  1991. </if>
  1992. <if test="isDefault != null and isDefault != ''">
  1993. and pfc.is_default = #{isDefault}
  1994. </if>
  1995. <if test="configStartTime != null and configStartTime != ''">
  1996. and pfc.start_time = #{configStartTime}
  1997. </if>
  1998. <if test="configEndTime != null and configEndTime != ''">
  1999. and pfc.end_time = #{configEndTime}
  2000. </if>
  2001. <if test="paymentCd != null and paymentCd != ''">
  2002. and pfc.payment_cd = #{paymentCd}
  2003. </if>
  2004. <if test="paymentCycle != null and paymentCycle != ''">
  2005. and pfc.payment_cycle = #{paymentCycle}
  2006. </if>
  2007. <if test="feeStartTime != null and feeStartTime != ''">
  2008. and t.create_time &gt;= #{feeStartTime}
  2009. </if>
  2010. <if test="feeEndTime != null and feeEndTime != ''">
  2011. and t.create_time &lt;= #{feeEndTime}
  2012. </if>
  2013. <if test="detailState != null and detailState != ''">
  2014. and pfd.state = #{detailState}
  2015. </if>
  2016. order by t.create_time desc
  2017. <if test="page != -1 and page != null ">
  2018. limit #{page}, #{row}
  2019. </if>
  2020. </select>
  2021. <!-- 查询押金退费总金额 -->
  2022. <select id="queryFeeDepositAmount" parameterType="Map" resultType="Map">
  2023. select SUM(pfc.additional_amount) allAmount,pfd.state detailState
  2024. from pay_fee t
  2025. INNER join pay_fee_config pfc on t.config_id = pfc.config_id and pfc.status_cd = '0' and pfc.fee_type_cd =
  2026. '888800010006'
  2027. left join pay_fee_detail pfd on t.fee_id = pfd.fee_id and pfd.status_cd = '0' and pfd.state != '1300'
  2028. left join t_dict td1 on pfc.fee_type_cd = td1.status_cd and td1.table_name = 'pay_fee_config' and
  2029. td1.table_columns = 'fee_type_cd'
  2030. left join t_dict td2 on t.state = td2.status_cd and td2.table_name = 'pay_fee' and td2.table_columns = 'state'
  2031. left join t_dict td3 on t.fee_flag = td3.status_cd and td3.table_name = 'pay_fee' and td3.table_columns =
  2032. 'fee_flag'
  2033. left join t_dict td4 on pfc.bill_type = td4.status_cd and td4.table_name = 'pay_fee_config' and
  2034. td4.table_columns = 'bill_type'
  2035. left join t_dict td5 on t.payer_obj_type = td5.status_cd and td5.table_name = 'pay_fee' and
  2036. td5.table_columns = 'payer_obj_type'
  2037. left join t_dict td6 on pfd.state = td6.status_cd and td6.table_name = 'pay_fee_detail' and
  2038. td6.table_columns = 'state'
  2039. left join pay_fee_attrs pfo on t.fee_id = pfo.fee_id and pfo.spec_cd = '390008'
  2040. LEFT JOIN pay_fee_attrs pfa1 on t.fee_id = pfa1.fee_id and pfa1.spec_cd = '390010' and pfa1.status_cd = '0'
  2041. left join building_room br on t.payer_obj_id = br.room_id and t.payer_obj_type = '3333' and br.status_cd = '0'
  2042. left join building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0'
  2043. left join f_floor f on bu.floor_id = f.floor_id and f.status_cd = '0'
  2044. left join owner_car oc on t.payer_obj_id = oc.car_id and oc.status_cd = '0' and oc.car_type_cd='1001'
  2045. where 1 = 1
  2046. <if test="roomNum !=null and roomNum != ''">
  2047. and br.room_num= #{roomNum}
  2048. </if>
  2049. <if test="unitId !=null and unitId != ''">
  2050. and bu.unit_id= #{unitId}
  2051. </if>
  2052. <if test="floorId !=null and floorId != ''">
  2053. and f.floor_id = #{floorId}
  2054. </if>
  2055. <if test="amount != null and amount != ''">
  2056. and t.amount = #{amount}
  2057. </if>
  2058. <if test="incomeObjId != null and incomeObjId != ''">
  2059. and t.income_obj_id = #{incomeObjId}
  2060. </if>
  2061. <if test="feeTypeCd != null and feeTypeCd != ''">
  2062. and t.fee_type_cd = #{feeTypeCd}
  2063. </if>
  2064. <if test="startTime != null and startTime != ''">
  2065. and t.start_time = #{startTime}
  2066. </if>
  2067. <if test="endTime != null and endTime != ''">
  2068. and t.end_time = #{endTime}
  2069. </if>
  2070. <if test="statusCd != null and statusCd != ''">
  2071. and t.status_cd = #{statusCd}
  2072. </if>
  2073. <if test="communityId != null and communityId != ''">
  2074. and t.community_id = #{communityId}
  2075. </if>
  2076. <if test="feeId != null and feeId != ''">
  2077. and t.fee_id = #{feeId}
  2078. </if>
  2079. <if test="userId != null and userId != ''">
  2080. and t.user_id = #{userId}
  2081. </if>
  2082. <if test="payerObjId != null and payerObjId != ''">
  2083. and t.payer_obj_id = #{payerObjId}
  2084. </if>
  2085. <if test="squarePrice != null and squarePrice != ''">
  2086. and pfc.square_price = #{squarePrice}
  2087. </if>
  2088. <if test="additionalAmount != null and additionalAmount != ''">
  2089. and pfc.additional_amount = #{additionalAmount}
  2090. </if>
  2091. <if test="feeFlag != null and feeFlag != ''">
  2092. and t.fee_flag = #{feeFlag}
  2093. </if>
  2094. <if test="state != null and state != ''">
  2095. and t.state = #{state}
  2096. </if>
  2097. <if test="configId != null and configId != ''">
  2098. and t.config_id = #{configId}
  2099. </if>
  2100. <if test="feeName != null and feeName != ''">
  2101. and pfc.fee_name = #{feeName}
  2102. </if>
  2103. <if test="computingFormula != null and computingFormula != ''">
  2104. and pfc.computing_formula = #{computingFormula}
  2105. </if>
  2106. <if test="computingFormulaText != null and computingFormulaText != ''">
  2107. and pfc.computing_formula_text = #{computingFormulaText}
  2108. </if>
  2109. <if test="billType != null and billType != ''">
  2110. and pfc.bill_type = #{billType}
  2111. </if>
  2112. <if test="payerObjType != null and payerObjType != ''">
  2113. and t.payer_obj_type = #{payerObjType}
  2114. </if>
  2115. <if test="isDefault != null and isDefault != ''">
  2116. and pfc.is_default = #{isDefault}
  2117. </if>
  2118. <if test="configStartTime != null and configStartTime != ''">
  2119. and pfc.start_time = #{configStartTime}
  2120. </if>
  2121. <if test="configEndTime != null and configEndTime != ''">
  2122. and pfc.end_time = #{configEndTime}
  2123. </if>
  2124. <if test="paymentCd != null and paymentCd != ''">
  2125. and pfc.payment_cd = #{paymentCd}
  2126. </if>
  2127. <if test="paymentCycle != null and paymentCycle != ''">
  2128. and pfc.payment_cycle = #{paymentCycle}
  2129. </if>
  2130. <if test="feeStartTime != null and feeStartTime != ''">
  2131. and t.create_time &gt;= #{feeStartTime}
  2132. </if>
  2133. <if test="feeEndTime != null and feeEndTime != ''">
  2134. and t.create_time &lt;= #{feeEndTime}
  2135. </if>
  2136. <if test="detailState != null and detailState != ''">
  2137. and pfd.state = #{detailState}
  2138. </if>
  2139. group by pfd.state
  2140. </select>
  2141. <select id="queryHuaningOweFeeCount" parameterType="Map" resultType="Map">
  2142. select count(1) count
  2143. from (
  2144. select a.floorNum,a.oweAmount,b.curOweAmount
  2145. from
  2146. (select t.floor_num floorNum,SUM(rfms.owe_amount) oweAmount
  2147. from f_floor t
  2148. left join building_unit bu on t.floor_id = bu.floor_id and bu.status_cd = '0'
  2149. left join building_room br on br.unit_id = bu.unit_id and br.status_cd = '0'
  2150. LEFT JOIN report_fee_month_statistics rfms on rfms.obj_id = br.room_id and rfms.obj_type = '3333' and
  2151. rfms.status_cd = '0'
  2152. where t.status_cd = '0'
  2153. <if test="communityId !=null and communityId != ''">
  2154. and t.community_id= #{communityId}
  2155. </if>
  2156. <if test="roomNum !=null and roomNum != ''">
  2157. and br.room_num= #{roomNum}
  2158. </if>
  2159. <if test="objName !=null and objName != ''">
  2160. and rfms.obj_name= #{objName}
  2161. </if>
  2162. GROUP BY t.floor_num
  2163. ) a,
  2164. (select t.floor_num floorNum,SUM(curT.owe_amount) curOweAmount
  2165. from f_floor t
  2166. left join building_unit bu on t.floor_id = bu.floor_id and bu.status_cd = '0'
  2167. left join building_room br on br.unit_id = bu.unit_id and br.status_cd = '0'
  2168. inner join report_fee_month_statistics curT on curT.obj_id = br.room_id and curT.obj_type = '3333' and
  2169. curT.status_cd = '0' and curT.community_id = t.community_id
  2170. where t.status_cd = '0'
  2171. <if test="communityId !=null and communityId != ''">
  2172. and t.community_id= #{communityId}
  2173. </if>
  2174. <if test="roomNum !=null and roomNum != ''">
  2175. and br.room_num= #{roomNum}
  2176. </if>
  2177. <if test="feeYear !=null and feeYear != ''">
  2178. and curT.fee_year= #{feeYear}
  2179. </if>
  2180. GROUP BY t.floor_num
  2181. ) b
  2182. where a.floorNum = b.floorNum
  2183. <if test="floorId !=null and floorId != ''">
  2184. and a.floor_id = #{floorId}
  2185. </if>
  2186. ) t
  2187. </select>
  2188. <!-- 查询费用月统计信息 add by wuxw 2018-07-03 -->
  2189. <select id="queryHuaningOweFee" parameterType="Map" resultType="Map">
  2190. select a.floorNum,a.oweAmount,b.curOweAmount
  2191. from
  2192. (select t.floor_num floorNum,SUM(rfms.owe_amount) oweAmount
  2193. from f_floor t
  2194. left join building_unit bu on t.floor_id = bu.floor_id and bu.status_cd = '0'
  2195. left join building_room br on br.unit_id = bu.unit_id and br.status_cd = '0'
  2196. LEFT JOIN report_fee_month_statistics rfms on rfms.obj_id = br.room_id and rfms.obj_type = '3333' and
  2197. rfms.status_cd = '0'
  2198. where t.status_cd = '0'
  2199. <if test="communityId !=null and communityId != ''">
  2200. and t.community_id= #{communityId}
  2201. </if>
  2202. <if test="roomNum !=null and roomNum != ''">
  2203. and br.room_num= #{roomNum}
  2204. </if>
  2205. <if test="objName !=null and objName != ''">
  2206. and rfms.obj_name= #{objName}
  2207. </if>
  2208. GROUP BY t.floor_num
  2209. ) a,
  2210. (select t.floor_num floorNum,SUM(curT.owe_amount) curOweAmount
  2211. from f_floor t
  2212. left join building_unit bu on t.floor_id = bu.floor_id and bu.status_cd = '0'
  2213. left join building_room br on br.unit_id = bu.unit_id and br.status_cd = '0'
  2214. inner join report_fee_month_statistics curT on curT.obj_id = br.room_id and curT.obj_type = '3333' and
  2215. curT.status_cd = '0' and curT.community_id = t.community_id
  2216. where t.status_cd = '0'
  2217. <if test="communityId !=null and communityId != ''">
  2218. and t.community_id= #{communityId}
  2219. </if>
  2220. <if test="roomNum !=null and roomNum != ''">
  2221. and br.room_num= #{roomNum}
  2222. </if>
  2223. <if test="feeYear !=null and feeYear != ''">
  2224. and curT.fee_year= #{feeYear}
  2225. </if>
  2226. GROUP BY t.floor_num
  2227. ) b
  2228. where a.floorNum = b.floorNum
  2229. <if test="floorId !=null and floorId != ''">
  2230. and a.floor_id = #{floorId}
  2231. </if>
  2232. <if test="page != -1 and page != null ">
  2233. limit #{page}, #{row}
  2234. </if>
  2235. </select>
  2236. <select id="queryHuaningPayFeeCount" parameterType="Map" resultType="Map">
  2237. select count(1) count
  2238. from (
  2239. select t.floor_num
  2240. from f_floor t
  2241. where 1=1
  2242. and t.community_id= #{communityId}
  2243. GROUP BY t.floor_num
  2244. ) tt
  2245. </select>
  2246. <!-- 查询费用月统计信息 add by wuxw 2018-07-03 -->
  2247. <select id="queryHuaningPayFee" parameterType="Map" resultType="Map">
  2248. select
  2249. a.floorNum,f.receivableAmount,a.receivedAmount,b.receivedAmount1,c.receivedAmount2,d.receivedAmount3,e.receivedAmount4
  2250. from
  2251. (select t.floor_num floorNum,sum(pfd.received_amount) receivedAmount
  2252. from f_floor t
  2253. inner JOIN building_unit bu on t.floor_id = bu.floor_id and bu.status_cd = '0'
  2254. inner JOIN building_room br on br.unit_id = bu.unit_id and br.status_cd = '0'
  2255. inner JOIN pay_fee pf on pf.payer_obj_id = br.room_id and pf.status_cd = '0'
  2256. inner join pay_fee_detail pfd on pf.fee_id = pfd.fee_id and pfd.status_cd = '0'
  2257. where 1=1
  2258. and t.status_cd = '0'
  2259. and DATE_FORMAT(pfd.create_time,'%Y-%m') = #{yearMonth}
  2260. and t.community_id= #{communityId}
  2261. GROUP BY floor_num
  2262. ) a,
  2263. (select t.floor_num floorNum,sum(pfdm1.received_amount ) receivedAmount1
  2264. from f_floor t
  2265. inner JOIN building_unit bu on t.floor_id = bu.floor_id and bu.status_cd = '0'
  2266. inner JOIN building_room br on br.unit_id = bu.unit_id and br.status_cd = '0'
  2267. inner JOIN pay_fee pf on pf.payer_obj_id = br.room_id and pf.status_cd = '0'
  2268. inner join pay_fee_detail pfd on pf.fee_id = pfd.fee_id and pfd.status_cd = '0'
  2269. LEFT JOIN pay_fee_detail_month pfdm1 on pf.fee_id = pfdm1.fee_id and pfd.detail_id = pfdm1.detail_id and
  2270. pfdm1.status_cd = '0' and pfdm1.detail_year = #{year} and pfdm1.detail_month &lt; #{month}
  2271. where 1=1
  2272. and t.status_cd = '0'
  2273. and DATE_FORMAT(pfd.create_time,'%Y-%m') = #{yearMonth}
  2274. and t.community_id= #{communityId}
  2275. GROUP BY floor_num
  2276. ) b,
  2277. (select t.floor_num floorNum,sum(pfdm2.received_amount ) receivedAmount2
  2278. from f_floor t
  2279. inner JOIN building_unit bu on t.floor_id = bu.floor_id and bu.status_cd = '0'
  2280. inner JOIN building_room br on br.unit_id = bu.unit_id and br.status_cd = '0'
  2281. inner JOIN pay_fee pf on pf.payer_obj_id = br.room_id and pf.status_cd = '0'
  2282. inner join pay_fee_detail pfd on pf.fee_id = pfd.fee_id and pfd.status_cd = '0'
  2283. LEFT JOIN pay_fee_detail_month pfdm2 on pf.fee_id = pfdm2.fee_id and pfd.detail_id = pfdm2.detail_id and
  2284. pfdm2.status_cd = '0' and pfdm2.detail_year = #{year} and pfdm2.detail_month = #{month}
  2285. where 1=1
  2286. and t.status_cd = '0'
  2287. and DATE_FORMAT(pfd.create_time,'%Y-%m') = #{yearMonth}
  2288. and t.community_id= #{communityId}
  2289. GROUP BY floor_num
  2290. ) c,
  2291. (select t.floor_num floorNum,sum(pfdm3.received_amount ) receivedAmount3
  2292. from f_floor t
  2293. inner JOIN building_unit bu on t.floor_id = bu.floor_id and bu.status_cd = '0'
  2294. inner JOIN building_room br on br.unit_id = bu.unit_id and br.status_cd = '0'
  2295. inner JOIN pay_fee pf on pf.payer_obj_id = br.room_id and pf.status_cd = '0'
  2296. inner join pay_fee_detail pfd on pf.fee_id = pfd.fee_id and pfd.status_cd = '0'
  2297. LEFT JOIN pay_fee_detail_month pfdm3 on pf.fee_id = pfdm3.fee_id and pfd.detail_id = pfdm3.detail_id and
  2298. pfdm3.status_cd = '0' and pfdm3.detail_year = #{nextYear} and pfdm3.detail_month = #{nextMonth}
  2299. where 1=1
  2300. and t.status_cd = '0'
  2301. and DATE_FORMAT(pfd.create_time,'%Y-%m') = #{yearMonth}
  2302. and t.community_id= #{communityId}
  2303. GROUP BY floor_num
  2304. ) d,
  2305. (select t.floor_num floorNum,sum(pfdm4.received_amount ) receivedAmount4
  2306. from f_floor t
  2307. inner JOIN building_unit bu on t.floor_id = bu.floor_id and bu.status_cd = '0'
  2308. inner JOIN building_room br on br.unit_id = bu.unit_id and br.status_cd = '0'
  2309. inner JOIN pay_fee pf on pf.payer_obj_id = br.room_id and pf.status_cd = '0'
  2310. inner join pay_fee_detail pfd on pf.fee_id = pfd.fee_id and pfd.status_cd = '0'
  2311. LEFT JOIN pay_fee_detail_month pfdm4 on pf.fee_id = pfdm4.fee_id and pfd.detail_id = pfdm4.detail_id and
  2312. pfdm4.status_cd = '0' and pfdm4.detail_year &lt; #{year}
  2313. where 1=1
  2314. and t.status_cd = '0'
  2315. and DATE_FORMAT(pfd.create_time,'%Y-%m') = #{yearMonth}
  2316. and t.community_id= #{communityId}
  2317. GROUP BY floor_num
  2318. ) e,
  2319. (select t.floor_num floorNum,SUM(rfms.receivable_amount) receivableAmount
  2320. from f_floor t
  2321. inner JOIN building_unit bu on t.floor_id = bu.floor_id and bu.status_cd = '0'
  2322. inner JOIN building_room br on br.unit_id = bu.unit_id and br.status_cd = '0'
  2323. inner JOIN report_fee_month_statistics rfms on rfms.obj_id = br.room_id and rfms.status_cd = '0'
  2324. where t.community_id = #{communityId}
  2325. and rfms.fee_year = #{year}
  2326. and rfms.fee_month = #{month}
  2327. group by t.floor_num
  2328. ) f
  2329. where a.floorNum = b.floorNum
  2330. and b.floorNum = c.floorNum
  2331. and c.floorNum = d.floorNum
  2332. and d.floorNum = e.floorNum
  2333. and e.floorNum = f.floorNum
  2334. <if test="page != -1 and page != null ">
  2335. limit #{page}, #{row}
  2336. </if>
  2337. </select>
  2338. <select id="queryHuaningPayFeeTwoCount" parameterType="Map" resultType="Map">
  2339. select count(1) count
  2340. from (
  2341. select a.floorNum,d.receivableAmount ,
  2342. a.receivedAmount,b.receivedAmount1,
  2343. c.receivedAmount2
  2344. from
  2345. (select t.floor_num floorNum,sum(pfd.received_amount) receivedAmount
  2346. from f_floor t
  2347. inner JOIN building_unit bu on t.floor_id = bu.floor_id and bu.status_cd = '0'
  2348. inner JOIN building_room br on br.unit_id = bu.unit_id and br.status_cd = '0'
  2349. inner JOIN pay_fee pf on pf.payer_obj_id = br.room_id and pf.status_cd = '0'
  2350. inner join pay_fee_detail pfd on pf.fee_id = pfd.fee_id and pfd.status_cd = '0'
  2351. where 1=1
  2352. and t.status_cd = '0'
  2353. and DATE_FORMAT(pfd.create_time,'%Y-%m') = #{yearMonth}
  2354. and t.community_id= #{communityId}
  2355. GROUP BY floor_num
  2356. ) a,
  2357. (select t.floor_num floorNum,SUM(pfdm1.discount_amount) receivedAmount1
  2358. from f_floor t
  2359. inner JOIN building_unit bu on t.floor_id = bu.floor_id and bu.status_cd = '0'
  2360. inner JOIN building_room br on br.unit_id = bu.unit_id and br.status_cd = '0'
  2361. inner JOIN pay_fee pf on pf.payer_obj_id = br.room_id and pf.status_cd = '0'
  2362. inner join pay_fee_detail pfd on pf.fee_id = pfd.fee_id and pfd.status_cd = '0'
  2363. LEFT JOIN pay_fee_detail_month pfdm1 on pf.fee_id = pfdm1.fee_id and pfd.detail_id = pfdm1.detail_id and
  2364. pfdm1.status_cd = '0' and pfdm1.detail_year = #{year} and pfdm1.detail_month &lt; #{month}
  2365. where 1=1
  2366. and t.status_cd = '0'
  2367. and DATE_FORMAT(pfd.create_time,'%Y-%m') = #{yearMonth}
  2368. and t.community_id= #{communityId}
  2369. GROUP BY floor_num
  2370. ) b,
  2371. (select t.floor_num floorNum,SUM(pfdm2.received_amount) receivedAmount2
  2372. from f_floor t
  2373. inner JOIN building_unit bu on t.floor_id = bu.floor_id and bu.status_cd = '0'
  2374. inner JOIN building_room br on br.unit_id = bu.unit_id and br.status_cd = '0'
  2375. inner JOIN pay_fee pf on pf.payer_obj_id = br.room_id and pf.status_cd = '0'
  2376. inner join pay_fee_detail pfd on pf.fee_id = pfd.fee_id and pfd.status_cd = '0'
  2377. LEFT JOIN pay_fee_detail_month pfdm2 on pf.fee_id = pfdm2.fee_id and pfd.detail_id = pfdm2.detail_id and
  2378. pfdm2.status_cd = '0' and pfdm2.detail_year = #{year} and pfdm2.detail_month &gt; #{month}
  2379. where 1=1
  2380. and t.status_cd = '0'
  2381. and DATE_FORMAT(pfd.create_time,'%Y-%m') = #{yearMonth}
  2382. and t.community_id= #{communityId}
  2383. GROUP BY floor_num
  2384. ) c,
  2385. (select t.floor_num floorNum,SUM(rfms.owe_amount) receivableAmount
  2386. from f_floor t
  2387. inner JOIN building_unit bu on t.floor_id = bu.floor_id and bu.status_cd = '0'
  2388. inner JOIN building_room br on br.unit_id = bu.unit_id and br.status_cd = '0'
  2389. inner JOIN report_fee_month_statistics rfms on rfms.obj_id = br.room_id and rfms.status_cd = '0'
  2390. where t.community_id= #{communityId}
  2391. group by t.floor_num
  2392. ) d
  2393. where a.floorNum = b.floorNum
  2394. and b.floorNum = c.floorNum
  2395. and c.floorNum = d.floorNum
  2396. ) tt
  2397. </select>
  2398. <!-- 查询费用月统计信息 add by wuxw 2018-07-03 -->
  2399. <select id="queryHuaningPayFeeTwo" parameterType="Map" resultType="Map">
  2400. select a.floorNum,d.receivableAmount ,
  2401. a.receivedAmount,b.receivedAmount1,
  2402. c.receivedAmount2
  2403. from
  2404. (select t.floor_num floorNum,sum(pfd.received_amount) receivedAmount
  2405. from f_floor t
  2406. inner JOIN building_unit bu on t.floor_id = bu.floor_id and bu.status_cd = '0'
  2407. inner JOIN building_room br on br.unit_id = bu.unit_id and br.status_cd = '0'
  2408. inner JOIN pay_fee pf on pf.payer_obj_id = br.room_id and pf.status_cd = '0'
  2409. inner join pay_fee_detail pfd on pf.fee_id = pfd.fee_id and pfd.status_cd = '0'
  2410. where 1=1
  2411. and t.status_cd = '0'
  2412. and DATE_FORMAT(pfd.create_time,'%Y-%m') = #{yearMonth}
  2413. and t.community_id= #{communityId}
  2414. GROUP BY floor_num
  2415. ) a,
  2416. (select t.floor_num floorNum,SUM(pfdm1.discount_amount) receivedAmount1
  2417. from f_floor t
  2418. inner JOIN building_unit bu on t.floor_id = bu.floor_id and bu.status_cd = '0'
  2419. inner JOIN building_room br on br.unit_id = bu.unit_id and br.status_cd = '0'
  2420. inner JOIN pay_fee pf on pf.payer_obj_id = br.room_id and pf.status_cd = '0'
  2421. inner join pay_fee_detail pfd on pf.fee_id = pfd.fee_id and pfd.status_cd = '0'
  2422. LEFT JOIN pay_fee_detail_month pfdm1 on pf.fee_id = pfdm1.fee_id and pfd.detail_id = pfdm1.detail_id and
  2423. pfdm1.status_cd = '0' and pfdm1.detail_year = #{year} and pfdm1.detail_month &lt; #{month}
  2424. where 1=1
  2425. and t.status_cd = '0'
  2426. and DATE_FORMAT(pfd.create_time,'%Y-%m') = #{yearMonth}
  2427. and t.community_id= #{communityId}
  2428. GROUP BY floor_num
  2429. ) b,
  2430. (select t.floor_num floorNum,SUM(pfdm2.received_amount) receivedAmount2
  2431. from f_floor t
  2432. inner JOIN building_unit bu on t.floor_id = bu.floor_id and bu.status_cd = '0'
  2433. inner JOIN building_room br on br.unit_id = bu.unit_id and br.status_cd = '0'
  2434. inner JOIN pay_fee pf on pf.payer_obj_id = br.room_id and pf.status_cd = '0'
  2435. inner join pay_fee_detail pfd on pf.fee_id = pfd.fee_id and pfd.status_cd = '0'
  2436. LEFT JOIN pay_fee_detail_month pfdm2 on pf.fee_id = pfdm2.fee_id and pfd.detail_id = pfdm2.detail_id and
  2437. pfdm2.status_cd = '0' and pfdm2.detail_year = #{year} and pfdm2.detail_month &gt; #{month}
  2438. where 1=1
  2439. and t.status_cd = '0'
  2440. and DATE_FORMAT(pfd.create_time,'%Y-%m') = #{yearMonth}
  2441. and t.community_id= #{communityId}
  2442. GROUP BY floor_num
  2443. ) c,
  2444. (select t.floor_num floorNum,SUM(rfms.owe_amount) receivableAmount
  2445. from f_floor t
  2446. inner JOIN building_unit bu on t.floor_id = bu.floor_id and bu.status_cd = '0'
  2447. inner JOIN building_room br on br.unit_id = bu.unit_id and br.status_cd = '0'
  2448. inner JOIN report_fee_month_statistics rfms on rfms.obj_id = br.room_id and rfms.status_cd = '0'
  2449. where t.community_id= #{communityId}
  2450. group by t.floor_num
  2451. ) d
  2452. where a.floorNum = b.floorNum
  2453. and b.floorNum = c.floorNum
  2454. and c.floorNum = d.floorNum
  2455. <if test="page != -1 and page != null ">
  2456. limit #{page}, #{row}
  2457. </if>
  2458. </select>
  2459. <select id="queryHuaningOweFeeDetailCount" parameterType="Map" resultType="Map">
  2460. select count(1) count
  2461. from (
  2462. select t.payer_obj_name payerObjName,br.built_up_area builtUpArea,pfc.square_price squarePrice, t.fee_id
  2463. feeId,t.end_time startTime,t.deadline_time endTime,t.amount_owed oweAmount
  2464. from report_owe_fee t
  2465. left join building_room br on t.payer_obj_id = br.room_id and br.status_cd = '0'
  2466. left join pay_fee_config pfc on t.config_id = pfc.config_id and pfc.status_cd = '0'
  2467. where t.amount_owed > 0
  2468. and pfc.fee_type_cd = '888800010001'
  2469. <if test="communityId !=null and communityId != ''">
  2470. and t.community_id= #{communityId}
  2471. </if>
  2472. ) tt
  2473. </select>
  2474. <!-- 查询费用月统计信息 add by wuxw 2018-07-03 -->
  2475. <select id="queryHuaningOweFeeDetail" parameterType="Map" resultType="Map">
  2476. select t.payer_obj_name payerObjName,br.built_up_area builtUpArea,pfc.square_price squarePrice, t.fee_id
  2477. feeId,t.end_time startTime,t.deadline_time endTime,t.amount_owed oweAmount
  2478. from report_owe_fee t
  2479. left join building_room br on t.payer_obj_id = br.room_id and br.status_cd = '0'
  2480. left join pay_fee_config pfc on t.config_id = pfc.config_id and pfc.status_cd = '0'
  2481. where t.amount_owed > 0
  2482. and pfc.fee_type_cd = '888800010001'
  2483. <if test="communityId !=null and communityId != ''">
  2484. and t.community_id= #{communityId}
  2485. </if>
  2486. <if test="page != -1 and page != null ">
  2487. limit #{page}, #{row}
  2488. </if>
  2489. </select>
  2490. <!-- 查询费用月统计信息 add by wuxw 2018-07-03 -->
  2491. <select id="getReceivedAmountByMonth" parameterType="Map" resultType="Map">
  2492. select ifnull(sum(t.received_amount),0) total
  2493. from pay_fee_detail_month t
  2494. where
  2495. 1=1
  2496. and t.create_time &gt; #{startTime}
  2497. and t.create_time &lt; #{endTime}
  2498. and t.fee_id = #{feeId}
  2499. <if test="flag == 1">
  2500. and concat(t.detail_year,t.detail_month) = #{yearMonth}
  2501. </if>
  2502. <if test="flag == 2">
  2503. and concat(t.detail_year,t.detail_month) &lt; #{yearMonth}
  2504. </if>
  2505. <if test="flag == 3">
  2506. and concat(t.detail_year,t.detail_month) &gt; #{yearMonth}
  2507. </if>
  2508. <if test="communityId !=null and communityId != ''">
  2509. and t.community_id= #{communityId}
  2510. </if>
  2511. </select>
  2512. </mapper>