ReportFeeMonthStatisticsServiceDaoImplMapper.xml 68 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper
  3. PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5. <mapper namespace="reportFeeMonthStatisticsServiceDaoImpl">
  6. <!-- 保存费用月统计信息 add by wuxw 2018-07-03 -->
  7. <insert id="saveReportFeeMonthStatisticsInfo" parameterType="Map">
  8. insert into report_fee_month_statistics(
  9. receivable_amount,statistics_id,update_time,remark,obj_name,received_amount,fee_year,fee_month,fee_id,config_id,
  10. obj_id,fee_name,owe_amount,community_id,fee_create_time,obj_type,deadline_time
  11. ) values (
  12. #{receivableAmount},#{statisticsId},#{updateTime},#{remark},#{objName},#{receivedAmount},#{feeYear},#{feeMonth},
  13. #{feeId},#{configId},#{objId},#{feeName},#{oweAmount},#{communityId},#{feeCreateTime},#{objType},#{deadlineTime}
  14. )
  15. </insert>
  16. <!-- 查询费用月统计信息 add by wuxw 2018-07-03 -->
  17. <select id="getReportFeeMonthStatisticsInfo" parameterType="Map" resultType="Map">
  18. select t.receivable_amount,t.receivable_amount receivableAmount,t.statistics_id,t.statistics_id
  19. statisticsId,t.update_time,t.update_time updateTime,t.remark,t.status_cd,t.status_cd
  20. statusCd,t.obj_name,t.obj_name objName,t.received_amount,t.received_amount receivedAmount,t.fee_year,t.fee_year
  21. feeYear,t.fee_month,t.fee_month feeMonth,t.fee_id,t.fee_id feeId,t.config_id,t.config_id
  22. configId,t.obj_id,t.obj_id objId,t.fee_name,t.fee_name feeName,t.owe_amount,t.owe_amount
  23. oweAmount,t.community_id,t.community_id communityId,t.fee_create_time,t.fee_create_time
  24. feeCreateTime,t.obj_type,t.obj_type objType
  25. from report_fee_month_statistics t
  26. inner join pay_fee pf on t.fee_id = pf.fee_id and pf.community_id = t.community_id and pf.status_cd = '0'
  27. where 1 =1
  28. <if test="receivableAmount !=null and receivableAmount != ''">
  29. and t.receivable_amount= #{receivableAmount}
  30. </if>
  31. <if test="statisticsId !=null and statisticsId != ''">
  32. and t.statistics_id= #{statisticsId}
  33. </if>
  34. <if test="updateTime !=null and updateTime != ''">
  35. and t.update_time= #{updateTime}
  36. </if>
  37. <if test="remark !=null and remark != ''">
  38. and t.remark= #{remark}
  39. </if>
  40. <if test="statusCd !=null and statusCd != ''">
  41. and t.status_cd= #{statusCd}
  42. </if>
  43. <if test="objName !=null and objName != ''">
  44. and t.obj_name= #{objName}
  45. </if>
  46. <if test="receivedAmount !=null and receivedAmount != ''">
  47. and t.received_amount= #{receivedAmount}
  48. </if>
  49. <if test="feeYear !=null and feeYear != ''">
  50. and t.fee_year= #{feeYear}
  51. </if>
  52. <if test="feeMonth !=null and feeMonth != ''">
  53. and t.fee_month= #{feeMonth}
  54. </if>
  55. <if test="feeId !=null and feeId != ''">
  56. and t.fee_id= #{feeId}
  57. </if>
  58. <if test="configId !=null and configId != ''">
  59. and t.config_id= #{configId}
  60. </if>
  61. <if test="objId !=null and objId != ''">
  62. and t.obj_id= #{objId}
  63. </if>
  64. <if test="feeName !=null and feeName != ''">
  65. and t.fee_name= #{feeName}
  66. </if>
  67. <if test="oweAmount !=null and oweAmount != ''">
  68. and t.owe_amount= #{oweAmount}
  69. </if>
  70. <if test="communityId !=null and communityId != ''">
  71. and t.community_id= #{communityId}
  72. </if>
  73. <if test="feeCreateTime !=null and feeCreateTime != ''">
  74. and t.fee_create_time= #{feeCreateTime}
  75. </if>
  76. <if test="objType !=null and objType != ''">
  77. and t.obj_type= #{objType}
  78. </if>
  79. order by t.create_time desc
  80. <if test="page != -1 and page != null ">
  81. limit #{page}, #{row}
  82. </if>
  83. </select>
  84. <!-- 修改费用月统计信息 add by wuxw 2018-07-03 -->
  85. <update id="updateReportFeeMonthStatisticsOwe" parameterType="Map">
  86. update report_fee_month_statistics t set
  87. t.owe_amount= #{oweAmount}
  88. where 1=1
  89. <if test="statisticsId !=null and statisticsId != ''">
  90. and t.statistics_id= #{statisticsId}
  91. </if>
  92. <if test="feeYear !=null ">
  93. and t.fee_year &lt;= #{feeYear}
  94. </if>
  95. <if test="feeMonth !=null ">
  96. and t.fee_month &lt;= #{feeMonth}
  97. </if>
  98. <if test="feeId !=null and feeId != ''">
  99. and t.fee_id= #{feeId}
  100. </if>
  101. </update>
  102. <!-- 修改费用月统计信息 add by wuxw 2018-07-03 -->
  103. <update id="updateReportFeeMonthStatisticsInfo" parameterType="Map">
  104. update report_fee_month_statistics t set t.status_cd = #{statusCd}
  105. <if test="newBId != null and newBId != ''">
  106. ,t.b_id = #{newBId}
  107. </if>
  108. <if test="receivableAmount !=null and receivableAmount != ''">
  109. , t.receivable_amount= #{receivableAmount}
  110. </if>
  111. <if test="updateTime !=null and updateTime != ''">
  112. , t.update_time= #{updateTime}
  113. </if>
  114. <if test="deadlineTime !=null ">
  115. , t.deadline_time= #{deadlineTime}
  116. </if>
  117. <if test="remark !=null and remark != ''">
  118. , t.remark= #{remark}
  119. </if>
  120. <if test="objName !=null and objName != ''">
  121. , t.obj_name= #{objName}
  122. </if>
  123. <if test="receivedAmount !=null and receivedAmount != ''">
  124. , t.received_amount= #{receivedAmount}
  125. </if>
  126. <if test="feeYear !=null and feeYear != ''">
  127. , t.fee_year= #{feeYear}
  128. </if>
  129. <if test="feeMonth !=null and feeMonth != ''">
  130. , t.fee_month= #{feeMonth}
  131. </if>
  132. <if test="feeId !=null and feeId != ''">
  133. , t.fee_id= #{feeId}
  134. </if>
  135. <if test="configId !=null and configId != ''">
  136. , t.config_id= #{configId}
  137. </if>
  138. <if test="objId !=null and objId != ''">
  139. , t.obj_id= #{objId}
  140. </if>
  141. <if test="feeName !=null and feeName != ''">
  142. , t.fee_name= #{feeName}
  143. </if>
  144. <if test="oweAmount !=null and oweAmount != ''">
  145. , t.owe_amount= #{oweAmount}
  146. </if>
  147. <if test="communityId !=null and communityId != ''">
  148. , t.community_id= #{communityId}
  149. </if>
  150. <if test="feeCreateTime !=null and feeCreateTime != ''">
  151. , t.fee_create_time= #{feeCreateTime}
  152. </if>
  153. <if test="objType !=null and objType != ''">
  154. , t.obj_type= #{objType}
  155. </if>
  156. where 1=1
  157. <if test="statisticsId !=null and statisticsId != ''">
  158. and t.statistics_id= #{statisticsId}
  159. </if>
  160. </update>
  161. <!-- 查询费用月统计数量 add by wuxw 2018-07-03 -->
  162. <select id="queryReportFeeMonthStatisticssCount" parameterType="Map" resultType="Map">
  163. select count(1) count
  164. from report_fee_month_statistics t
  165. inner join pay_fee pf on t.fee_id = pf.fee_id and pf.community_id = t.community_id and pf.status_cd = '0'
  166. where 1 =1
  167. <if test="receivableAmount !=null and receivableAmount != ''">
  168. and t.receivable_amount= #{receivableAmount}
  169. </if>
  170. <if test="statisticsId !=null and statisticsId != ''">
  171. and t.statistics_id= #{statisticsId}
  172. </if>
  173. <if test="updateTime !=null and updateTime != ''">
  174. and t.update_time= #{updateTime}
  175. </if>
  176. <if test="remark !=null and remark != ''">
  177. and t.remark= #{remark}
  178. </if>
  179. <if test="statusCd !=null and statusCd != ''">
  180. and t.status_cd= #{statusCd}
  181. </if>
  182. <if test="objName !=null and objName != ''">
  183. and t.obj_name= #{objName}
  184. </if>
  185. <if test="receivedAmount !=null and receivedAmount != ''">
  186. and t.received_amount= #{receivedAmount}
  187. </if>
  188. <if test="feeYear !=null and feeYear != ''">
  189. and t.fee_year= #{feeYear}
  190. </if>
  191. <if test="feeMonth !=null and feeMonth != ''">
  192. and t.fee_month= #{feeMonth}
  193. </if>
  194. <if test="feeId !=null and feeId != ''">
  195. and t.fee_id= #{feeId}
  196. </if>
  197. <if test="configId !=null and configId != ''">
  198. and t.config_id= #{configId}
  199. </if>
  200. <if test="objId !=null and objId != ''">
  201. and t.obj_id= #{objId}
  202. </if>
  203. <if test="feeName !=null and feeName != ''">
  204. and t.fee_name= #{feeName}
  205. </if>
  206. <if test="oweAmount !=null and oweAmount != ''">
  207. and t.owe_amount= #{oweAmount}
  208. </if>
  209. <if test="communityId !=null and communityId != ''">
  210. and t.community_id= #{communityId}
  211. </if>
  212. <if test="feeCreateTime !=null and feeCreateTime != ''">
  213. and t.fee_create_time= #{feeCreateTime}
  214. </if>
  215. <if test="objType !=null and objType != ''">
  216. and t.obj_type= #{objType}
  217. </if>
  218. </select>
  219. <!-- 查询费用月统计数量 add by wuxw 2018-07-03 -->
  220. <select id="queryReportFeeSummaryCount" parameterType="Map" resultType="Map">
  221. select count(1) count
  222. from (
  223. select t.fee_year,t.fee_month
  224. from report_fee_month_statistics t
  225. left join building_room br on t.obj_id = br.room_id and t.obj_type = '3333' and br.status_cd = '0'
  226. left join building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0'
  227. left join f_floor f on bu.floor_id = f.floor_id and f.status_cd = '0'
  228. inner join pay_fee pf on t.fee_id = pf.fee_id and pf.community_id = t.community_id and pf.status_cd = '0'
  229. where t.status_cd = '0'
  230. <if test="roomNum !=null and roomNum != ''">
  231. and br.room_num= #{roomNum}
  232. </if>
  233. <if test="unitId !=null and unitId != ''">
  234. and bu.unit_id= #{unitId}
  235. </if>
  236. <if test="floorId !=null and floorId != ''">
  237. and f.floor_id = #{floorId}
  238. </if>
  239. <if test="objName !=null and objName != ''">
  240. and t.obj_name= #{objName}
  241. </if>
  242. <if test="feeYear !=null and feeYear != ''">
  243. and t.fee_year= #{feeYear}
  244. </if>
  245. <if test="feeMonth !=null and feeMonth != ''">
  246. and t.fee_month= #{feeMonth}
  247. </if>
  248. <if test="feeId !=null and feeId != ''">
  249. and t.fee_id= #{feeId}
  250. </if>
  251. <if test="configId !=null and configId != ''">
  252. and t.config_id= #{configId}
  253. </if>
  254. <if test="objId !=null and objId != ''">
  255. and t.obj_id= #{objId}
  256. </if>
  257. <if test="feeName !=null and feeName != ''">
  258. and t.fee_name= #{feeName}
  259. </if>
  260. <if test="communityId !=null and communityId != ''">
  261. and t.community_id= #{communityId}
  262. </if>
  263. <if test="startTime !=null">
  264. and t.create_time &gt;= #{startTime}
  265. </if>
  266. <if test="endTime !=null">
  267. and t.create_time &lt;= #{endTime}
  268. </if>
  269. group by t.fee_year,t.fee_month
  270. ) t
  271. </select>
  272. <!-- 查询费用月统计信息 add by wuxw 2018-07-03 -->
  273. <select id="queryReportFeeSummary" parameterType="Map" resultType="Map">
  274. select t.fee_year feeYear,t.fee_month feeMonth,t.create_time createTime,SUM(t.receivable_amount)
  275. receivableAmount,SUM(t.received_amount)
  276. receivedAmount,SUM(t.owe_amount) oweAmount
  277. from report_fee_month_statistics t
  278. left join building_room br on t.obj_id = br.room_id and t.obj_type = '3333' and br.status_cd = '0'
  279. left join building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0'
  280. left join f_floor f on bu.floor_id = f.floor_id and f.status_cd = '0'
  281. inner join pay_fee pf on t.fee_id = pf.fee_id and pf.community_id = t.community_id and pf.status_cd = '0'
  282. where t.status_cd = '0'
  283. <if test="roomNum !=null and roomNum != ''">
  284. and br.room_num= #{roomNum}
  285. </if>
  286. <if test="unitId !=null and unitId != ''">
  287. and bu.unit_id= #{unitId}
  288. </if>
  289. <if test="floorId !=null and floorId != ''">
  290. and f.floor_id = #{floorId}
  291. </if>
  292. <if test="objName !=null and objName != ''">
  293. and t.obj_name= #{objName}
  294. </if>
  295. <if test="feeYear !=null and feeYear != ''">
  296. and t.fee_year= #{feeYear}
  297. </if>
  298. <if test="feeMonth !=null and feeMonth != ''">
  299. and t.fee_month= #{feeMonth}
  300. </if>
  301. <if test="feeId !=null and feeId != ''">
  302. and t.fee_id= #{feeId}
  303. </if>
  304. <if test="configId !=null and configId != ''">
  305. and t.config_id= #{configId}
  306. </if>
  307. <if test="objId !=null and objId != ''">
  308. and t.obj_id= #{objId}
  309. </if>
  310. <if test="feeName !=null and feeName != ''">
  311. and t.fee_name= #{feeName}
  312. </if>
  313. <if test="communityId !=null and communityId != ''">
  314. and t.community_id= #{communityId}
  315. </if>
  316. <if test="startTime !=null">
  317. and t.create_time &gt;= #{startTime}
  318. </if>
  319. <if test="endTime !=null">
  320. and t.create_time &lt;= #{endTime}
  321. </if>
  322. group by t.fee_year,t.fee_month
  323. <if test="page != -1 and page != null ">
  324. limit #{page}, #{row}
  325. </if>
  326. </select>
  327. <select id="queryReportFloorUnitFeeSummaryCount" parameterType="Map" resultType="Map">
  328. select count(1) count
  329. from (
  330. select t.fee_year feeYear,t.fee_month feeMonth, f.floor_num flooNum, bu.unit_num unitNum
  331. from report_fee_month_statistics t
  332. INNER JOIN building_room br on t.obj_id = br.room_id and br.status_cd = '0'
  333. inner join building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0'
  334. inner join f_floor f on bu.floor_id = f.floor_id and f.status_cd = '0'
  335. inner join pay_fee pf on t.fee_id = pf.fee_id and pf.community_id = t.community_id and pf.status_cd = '0'
  336. where t.status_cd = '0'
  337. <if test="roomNum !=null and roomNum != ''">
  338. and br.room_num= #{roomNum}
  339. </if>
  340. <if test="unitId !=null and unitId != ''">
  341. and bu.unit_id= #{unitId}
  342. </if>
  343. <if test="floorId !=null and floorId != ''">
  344. and f.floor_id = #{floorId}
  345. </if>
  346. <if test="objName !=null and objName != ''">
  347. and t.obj_name= #{objName}
  348. </if>
  349. <if test="feeYear !=null and feeYear != ''">
  350. and t.fee_year= #{feeYear}
  351. </if>
  352. <if test="feeMonth !=null and feeMonth != ''">
  353. and t.fee_month= #{feeMonth}
  354. </if>
  355. <if test="feeId !=null and feeId != ''">
  356. and t.fee_id= #{feeId}
  357. </if>
  358. <if test="configId !=null and configId != ''">
  359. and t.config_id= #{configId}
  360. </if>
  361. <if test="objId !=null and objId != ''">
  362. and t.obj_id= #{objId}
  363. </if>
  364. <if test="feeName !=null and feeName != ''">
  365. and t.fee_name= #{feeName}
  366. </if>
  367. <if test="communityId !=null and communityId != ''">
  368. and t.community_id= #{communityId}
  369. </if>
  370. <if test="startTime !=null">
  371. and t.create_time &gt;= #{startTime}
  372. </if>
  373. <if test="endTime !=null">
  374. and t.create_time &lt;= #{endTime}
  375. </if>
  376. GROUP BY t.fee_year,t.fee_month,f.floor_num,bu.unit_id,bu.unit_num
  377. ) t
  378. </select>
  379. <!-- 查询费用月统计信息 add by wuxw 2018-07-03 -->
  380. <select id="queryReportFloorUnitFeeSummary" parameterType="Map" resultType="Map">
  381. select t.fee_year feeYear,t.fee_month feeMonth, f.floor_num floorNum, bu.unit_num unitNum,t.create_time
  382. createTime,
  383. SUM(t.receivable_amount) receivableAmount,SUM(t.received_amount) receivedAmount,SUM(t.owe_amount) oweAmount
  384. from report_fee_month_statistics t
  385. INNER JOIN building_room br on t.obj_id = br.room_id and br.status_cd = '0'
  386. inner join building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0'
  387. inner join f_floor f on bu.floor_id = f.floor_id and f.status_cd = '0'
  388. inner join pay_fee pf on t.fee_id = pf.fee_id and pf.community_id = t.community_id and pf.status_cd = '0'
  389. where t.status_cd = '0'
  390. <if test="roomNum !=null and roomNum != ''">
  391. and br.room_num= #{roomNum}
  392. </if>
  393. <if test="unitId !=null and unitId != ''">
  394. and bu.unit_id= #{unitId}
  395. </if>
  396. <if test="floorId !=null and floorId != ''">
  397. and f.floor_id = #{floorId}
  398. </if>
  399. <if test="objName !=null and objName != ''">
  400. and t.obj_name= #{objName}
  401. </if>
  402. <if test="feeYear !=null and feeYear != ''">
  403. and t.fee_year= #{feeYear}
  404. </if>
  405. <if test="feeMonth !=null and feeMonth != ''">
  406. and t.fee_month= #{feeMonth}
  407. </if>
  408. <if test="feeId !=null and feeId != ''">
  409. and t.fee_id= #{feeId}
  410. </if>
  411. <if test="configId !=null and configId != ''">
  412. and t.config_id= #{configId}
  413. </if>
  414. <if test="objId !=null and objId != ''">
  415. and t.obj_id= #{objId}
  416. </if>
  417. <if test="feeName !=null and feeName != ''">
  418. and t.fee_name= #{feeName}
  419. </if>
  420. <if test="communityId !=null and communityId != ''">
  421. and t.community_id= #{communityId}
  422. </if>
  423. <if test="startTime !=null">
  424. and t.create_time &gt;= #{startTime}
  425. </if>
  426. <if test="endTime !=null">
  427. and t.create_time &lt;= #{endTime}
  428. </if>
  429. GROUP BY t.fee_year,t.fee_month,f.floor_num,bu.unit_id,bu.unit_num
  430. <if test="page != -1 and page != null ">
  431. limit #{page}, #{row}
  432. </if>
  433. </select>
  434. <select id="queryFeeBreakdownCount" parameterType="Map" resultType="Map">
  435. select count(1) count
  436. from (
  437. select t.fee_name feeName,td.name feeTypeCd,pfc.fee_type_cd,pfc.start_time feeCreateTime,t.create_time
  438. createTime,SUM(t.receivable_amount)
  439. receivableAmount,SUM(t.received_amount) receivedAmount,SUM(t.owe_amount) oweAmount
  440. from report_fee_month_statistics t
  441. inner join pay_fee_config pfc on t.config_id = pfc.config_id and pfc.status_cd = '0'
  442. left join building_room br on t.obj_id = br.room_id and t.obj_type = '3333' and br.status_cd = '0'
  443. left join building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0'
  444. left join f_floor f on bu.floor_id = f.floor_id and f.status_cd = '0'
  445. left join t_dict td on pfc.fee_type_cd = td.status_cd and td.table_name='pay_fee_config' and
  446. td.table_columns='fee_type_cd'
  447. inner join pay_fee pf on t.fee_id = pf.fee_id and pf.community_id = t.community_id and pf.status_cd = '0'
  448. where t.status_cd = '0'
  449. <if test="roomNum !=null and roomNum != ''">
  450. and br.room_num= #{roomNum}
  451. </if>
  452. <if test="unitId !=null and unitId != ''">
  453. and bu.unit_id= #{unitId}
  454. </if>
  455. <if test="floorId !=null and floorId != ''">
  456. and f.floor_id = #{floorId}
  457. </if>
  458. <if test="objName !=null and objName != ''">
  459. and t.obj_name= #{objName}
  460. </if>
  461. <if test="feeYear !=null and feeYear != ''">
  462. and t.fee_year= #{feeYear}
  463. </if>
  464. <if test="feeMonth !=null and feeMonth != ''">
  465. and t.fee_month= #{feeMonth}
  466. </if>
  467. <if test="feeId !=null and feeId != ''">
  468. and t.fee_id= #{feeId}
  469. </if>
  470. <if test="configId !=null and configId != ''">
  471. and pfc.config_id= #{configId}
  472. </if>
  473. <if test="objId !=null and objId != ''">
  474. and t.obj_id= #{objId}
  475. </if>
  476. <if test="feeName !=null and feeName != ''">
  477. and t.fee_name= #{feeName}
  478. </if>
  479. <if test="feeTypeCd != null and feeTypeCd != ''">
  480. and pfc.fee_type_cd = #{feeTypeCd}
  481. </if>
  482. <if test="communityId !=null and communityId != ''">
  483. and t.community_id= #{communityId}
  484. </if>
  485. <if test="startTime !=null">
  486. and t.create_time &gt;= #{startTime}
  487. </if>
  488. <if test="endTime !=null">
  489. and t.create_time &lt;= #{endTime}
  490. </if>
  491. group by t.config_id,t.fee_name,pfc.start_time
  492. ) t
  493. </select>
  494. <!-- 查询费用月统计信息 add by wuxw 2018-07-03 -->
  495. <select id="queryFeeBreakdown" parameterType="Map" resultType="Map">
  496. select t.fee_name feeName,td.name feeTypeCd,pfc.fee_type_cd,pfc.start_time feeCreateTime,t.create_time
  497. createTime,SUM(t.receivable_amount)
  498. receivableAmount,SUM(t.received_amount) receivedAmount,SUM(t.owe_amount) oweAmount
  499. from report_fee_month_statistics t
  500. inner join pay_fee_config pfc on t.config_id = pfc.config_id and pfc.status_cd = '0'
  501. left join building_room br on t.obj_id = br.room_id and t.obj_type = '3333' and br.status_cd = '0'
  502. left join building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0'
  503. left join f_floor f on bu.floor_id = f.floor_id and f.status_cd = '0'
  504. left join t_dict td on pfc.fee_type_cd = td.status_cd and td.table_name='pay_fee_config' and
  505. td.table_columns='fee_type_cd'
  506. inner join pay_fee pf on t.fee_id = pf.fee_id and pf.community_id = t.community_id and pf.status_cd = '0'
  507. where t.status_cd = '0'
  508. <if test="roomNum !=null and roomNum != ''">
  509. and br.room_num= #{roomNum}
  510. </if>
  511. <if test="unitId !=null and unitId != ''">
  512. and bu.unit_id= #{unitId}
  513. </if>
  514. <if test="floorId !=null and floorId != ''">
  515. and f.floor_id = #{floorId}
  516. </if>
  517. <if test="objName !=null and objName != ''">
  518. and t.obj_name= #{objName}
  519. </if>
  520. <if test="feeYear !=null and feeYear != ''">
  521. and t.fee_year= #{feeYear}
  522. </if>
  523. <if test="feeMonth !=null and feeMonth != ''">
  524. and t.fee_month= #{feeMonth}
  525. </if>
  526. <if test="feeId !=null and feeId != ''">
  527. and t.fee_id= #{feeId}
  528. </if>
  529. <if test="configId !=null and configId != ''">
  530. and pfc.config_id= #{configId}
  531. </if>
  532. <if test="objId !=null and objId != ''">
  533. and t.obj_id= #{objId}
  534. </if>
  535. <if test="feeName !=null and feeName != ''">
  536. and t.fee_name= #{feeName}
  537. </if>
  538. <if test="feeTypeCd != null and feeTypeCd != ''">
  539. and pfc.fee_type_cd = #{feeTypeCd}
  540. </if>
  541. <if test="communityId !=null and communityId != ''">
  542. and t.community_id= #{communityId}
  543. </if>
  544. <if test="startTime !=null">
  545. and t.create_time &gt;= #{startTime}
  546. </if>
  547. <if test="endTime !=null">
  548. and t.create_time &lt;= #{endTime}
  549. </if>
  550. group by t.config_id,t.fee_name,pfc.start_time
  551. <if test="page != -1 and page != null ">
  552. limit #{page}, #{row}
  553. </if>
  554. </select>
  555. <select id="queryFeeDetailCount" parameterType="Map" resultType="Map">
  556. select count(1) count
  557. from (
  558. select t.obj_name objName,t.fee_name feeName,pfc.start_time
  559. from report_fee_month_statistics t
  560. inner join pay_fee_config pfc on t.config_id = pfc.config_id and pfc.status_cd = '0'
  561. left join building_room br on t.obj_id = br.room_id and t.obj_type = '3333' and br.status_cd = '0'
  562. left join building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0'
  563. left join f_floor f on bu.floor_id = f.floor_id and f.status_cd = '0'
  564. inner join pay_fee pf on t.fee_id = pf.fee_id and pf.community_id = t.community_id and pf.status_cd = '0'
  565. where t.status_cd = '0'
  566. <if test="roomNum !=null and roomNum != ''">
  567. and br.room_num= #{roomNum}
  568. </if>
  569. <if test="unitId !=null and unitId != ''">
  570. and bu.unit_id= #{unitId}
  571. </if>
  572. <if test="floorId !=null and floorId != ''">
  573. and f.floor_id = #{floorId}
  574. </if>
  575. <if test="objName !=null and objName != ''">
  576. and t.obj_name= #{objName}
  577. </if>
  578. <if test="feeYear !=null and feeYear != ''">
  579. and t.fee_year= #{feeYear}
  580. </if>
  581. <if test="feeMonth !=null and feeMonth != ''">
  582. and t.fee_month= #{feeMonth}
  583. </if>
  584. <if test="feeId !=null and feeId != ''">
  585. and t.fee_id= #{feeId}
  586. </if>
  587. <if test="configId !=null and configId != ''">
  588. and t.config_id= #{configId}
  589. </if>
  590. <if test="objId !=null and objId != ''">
  591. and t.obj_id= #{objId}
  592. </if>
  593. <if test="feeName !=null and feeName != ''">
  594. and t.fee_name= #{feeName}
  595. </if>
  596. <if test="communityId !=null and communityId != ''">
  597. and t.community_id= #{communityId}
  598. </if>
  599. <if test="startTime !=null">
  600. and t.create_time &gt;= #{startTime}
  601. </if>
  602. <if test="endTime !=null">
  603. and t.create_time &lt;= #{endTime}
  604. </if>
  605. group by t.config_id,t.fee_name,t.fee_create_time,t.obj_id,t.obj_name,t.deadline_time
  606. ) t
  607. </select>
  608. <!-- 查询费用月统计信息 add by wuxw 2018-07-03 -->
  609. <select id="queryFeeDetail" parameterType="Map" resultType="Map">
  610. select t.obj_name objName,t.fee_name feeName,t.fee_create_time feeCreateTime,t.deadline_time
  611. deadlineTime,t.create_time createTime,SUM(t.receivable_amount) receivableAmount,SUM(t.received_amount)
  612. receivedAmount,SUM(t.owe_amount) oweAmount
  613. from report_fee_month_statistics t
  614. inner join pay_fee_config pfc on t.config_id = pfc.config_id and pfc.status_cd = '0'
  615. left join building_room br on t.obj_id = br.room_id and t.obj_type = '3333' and br.status_cd = '0'
  616. left join building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0'
  617. left join f_floor f on bu.floor_id = f.floor_id and f.status_cd = '0'
  618. inner join pay_fee pf on t.fee_id = pf.fee_id and pf.community_id = t.community_id and pf.status_cd = '0'
  619. where t.status_cd = '0'
  620. <if test="roomNum !=null and roomNum != ''">
  621. and br.room_num= #{roomNum}
  622. </if>
  623. <if test="unitId !=null and unitId != ''">
  624. and bu.unit_id= #{unitId}
  625. </if>
  626. <if test="floorId !=null and floorId != ''">
  627. and f.floor_id = #{floorId}
  628. </if>
  629. <if test="objName !=null and objName != ''">
  630. and t.obj_name= #{objName}
  631. </if>
  632. <if test="feeYear !=null and feeYear != ''">
  633. and t.fee_year= #{feeYear}
  634. </if>
  635. <if test="feeMonth !=null and feeMonth != ''">
  636. and t.fee_month= #{feeMonth}
  637. </if>
  638. <if test="feeId !=null and feeId != ''">
  639. and t.fee_id= #{feeId}
  640. </if>
  641. <if test="configId !=null and configId != ''">
  642. and t.config_id= #{configId}
  643. </if>
  644. <if test="objId !=null and objId != ''">
  645. and t.obj_id= #{objId}
  646. </if>
  647. <if test="feeName !=null and feeName != ''">
  648. and t.fee_name= #{feeName}
  649. </if>
  650. <if test="communityId !=null and communityId != ''">
  651. and t.community_id= #{communityId}
  652. </if>
  653. <if test="startTime !=null">
  654. and t.create_time &gt;= #{startTime}
  655. </if>
  656. <if test="endTime !=null">
  657. and t.create_time &lt;= #{endTime}
  658. </if>
  659. group by t.config_id,t.fee_name,t.fee_create_time,t.obj_id,t.obj_name,t.deadline_time
  660. <if test="page != -1 and page != null ">
  661. limit #{page}, #{row}
  662. </if>
  663. </select>
  664. <!-- 查询费用月统计信息 add by wuxw 2018-07-03 -->
  665. <select id="queryAllFeeDetail" parameterType="Map" resultType="Map">
  666. select SUM(t.receivable_amount) allReceivableAmount,SUM(t.received_amount) allReceivedAmount,
  667. SUM(t.owe_amount) allOweAmount from report_fee_month_statistics t
  668. inner join pay_fee_config pfc on t.config_id = pfc.config_id and pfc.status_cd = '0'
  669. left join building_room br on t.obj_id = br.room_id and t.obj_type = '3333' and br.status_cd = '0'
  670. left join building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0'
  671. left join f_floor f on bu.floor_id = f.floor_id and f.status_cd = '0'
  672. inner join pay_fee pf on t.fee_id = pf.fee_id and pf.community_id = t.community_id and pf.status_cd = '0'
  673. where t.status_cd = '0'
  674. <if test="roomNum !=null and roomNum != ''">
  675. and br.room_num= #{roomNum}
  676. </if>
  677. <if test="unitId !=null and unitId != ''">
  678. and bu.unit_id= #{unitId}
  679. </if>
  680. <if test="floorId !=null and floorId != ''">
  681. and f.floor_id = #{floorId}
  682. </if>
  683. <if test="objName !=null and objName != ''">
  684. and t.obj_name= #{objName}
  685. </if>
  686. <if test="feeYear !=null and feeYear != ''">
  687. and t.fee_year= #{feeYear}
  688. </if>
  689. <if test="feeMonth !=null and feeMonth != ''">
  690. and t.fee_month= #{feeMonth}
  691. </if>
  692. <if test="feeId !=null and feeId != ''">
  693. and t.fee_id= #{feeId}
  694. </if>
  695. <if test="configId !=null and configId != ''">
  696. and t.config_id= #{configId}
  697. </if>
  698. <if test="objId !=null and objId != ''">
  699. and t.obj_id= #{objId}
  700. </if>
  701. <if test="feeName !=null and feeName != ''">
  702. and t.fee_name= #{feeName}
  703. </if>
  704. <if test="communityId !=null and communityId != ''">
  705. and t.community_id= #{communityId}
  706. </if>
  707. <if test="startTime !=null">
  708. and t.create_time &gt;= #{startTime}
  709. </if>
  710. <if test="endTime !=null">
  711. and t.create_time &lt;= #{endTime}
  712. </if>
  713. </select>
  714. <select id="queryOweFeeDetailCount" parameterType="Map" resultType="Map">
  715. select count(1) count
  716. from (
  717. select t.obj_name objName,t.fee_name feeName,pfc.start_time,SUM(t.owe_amount) oweAmount
  718. from report_fee_month_statistics t
  719. inner join pay_fee_config pfc on t.config_id = pfc.config_id and pfc.status_cd = '0'
  720. left join building_room br on t.obj_id = br.room_id and t.obj_type = '3333' and br.status_cd = '0'
  721. left join building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0'
  722. left join f_floor f on bu.floor_id = f.floor_id and f.status_cd = '0'
  723. inner join pay_fee pf on t.fee_id = pf.fee_id and pf.community_id = t.community_id and pf.status_cd = '0'
  724. where t.status_cd = '0'
  725. <if test="roomNum !=null and roomNum != ''">
  726. and br.room_num= #{roomNum}
  727. </if>
  728. <if test="unitId !=null and unitId != ''">
  729. and bu.unit_id= #{unitId}
  730. </if>
  731. <if test="floorId !=null and floorId != ''">
  732. and f.floor_id = #{floorId}
  733. </if>
  734. <if test="objName !=null and objName != ''">
  735. and t.obj_name= #{objName}
  736. </if>
  737. <if test="feeYear !=null and feeYear != ''">
  738. and t.fee_year= #{feeYear}
  739. </if>
  740. <if test="feeMonth !=null and feeMonth != ''">
  741. and t.fee_month= #{feeMonth}
  742. </if>
  743. <if test="feeId !=null and feeId != ''">
  744. and t.fee_id= #{feeId}
  745. </if>
  746. <if test="configId !=null and configId != ''">
  747. and t.config_id= #{configId}
  748. </if>
  749. <if test="objId !=null and objId != ''">
  750. and t.obj_id= #{objId}
  751. </if>
  752. <if test="feeName !=null and feeName != ''">
  753. and t.fee_name= #{feeName}
  754. </if>
  755. <if test="communityId !=null and communityId != ''">
  756. and t.community_id= #{communityId}
  757. </if>
  758. <if test="startTime !=null">
  759. and t.create_time &gt;= #{startTime}
  760. </if>
  761. <if test="endTime !=null">
  762. and t.create_time &lt;= #{endTime}
  763. </if>
  764. group by t.config_id,t.fee_name,pfc.start_time,t.obj_id,t.obj_name
  765. HAVING oweAmount > 0
  766. ) t
  767. </select>
  768. <!-- 查询费用月统计信息 add by wuxw 2018-07-03 -->
  769. <select id="queryOweFeeDetail" parameterType="Map" resultType="Map">
  770. select t.obj_name objName,t.fee_name feeName,t.fee_create_time feeCreateTime,t.create_time
  771. createTime,SUM(t.receivable_amount)
  772. receivableAmount,SUM(t.received_amount) receivedAmount,SUM(t.owe_amount) oweAmount
  773. from report_fee_month_statistics t
  774. inner join pay_fee_config pfc on t.config_id = pfc.config_id and pfc.status_cd = '0'
  775. left join building_room br on t.obj_id = br.room_id and t.obj_type = '3333' and br.status_cd = '0'
  776. left join building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0'
  777. left join f_floor f on bu.floor_id = f.floor_id and f.status_cd = '0'
  778. inner join pay_fee pf on t.fee_id = pf.fee_id and pf.community_id = t.community_id and pf.status_cd = '0'
  779. where t.status_cd = '0'
  780. <if test="roomNum !=null and roomNum != ''">
  781. and br.room_num= #{roomNum}
  782. </if>
  783. <if test="unitId !=null and unitId != ''">
  784. and bu.unit_id= #{unitId}
  785. </if>
  786. <if test="floorId !=null and floorId != ''">
  787. and f.floor_id = #{floorId}
  788. </if>
  789. <if test="objName !=null and objName != ''">
  790. and t.obj_name= #{objName}
  791. </if>
  792. <if test="feeYear !=null and feeYear != ''">
  793. and t.fee_year= #{feeYear}
  794. </if>
  795. <if test="feeMonth !=null and feeMonth != ''">
  796. and t.fee_month= #{feeMonth}
  797. </if>
  798. <if test="feeId !=null and feeId != ''">
  799. and t.fee_id= #{feeId}
  800. </if>
  801. <if test="configId !=null and configId != ''">
  802. and t.config_id= #{configId}
  803. </if>
  804. <if test="objId !=null and objId != ''">
  805. and t.obj_id= #{objId}
  806. </if>
  807. <if test="feeName !=null and feeName != ''">
  808. and t.fee_name= #{feeName}
  809. </if>
  810. <if test="communityId !=null and communityId != ''">
  811. and t.community_id= #{communityId}
  812. </if>
  813. <if test="startTime !=null">
  814. and t.create_time &gt;= #{startTime}
  815. </if>
  816. <if test="endTime !=null">
  817. and t.create_time &lt;= #{endTime}
  818. </if>
  819. group by t.config_id,t.fee_name,pfc.start_time,t.obj_id,t.obj_name
  820. HAVING oweAmount > 0
  821. <if test="page != -1 and page != null ">
  822. limit #{page}, #{row}
  823. </if>
  824. </select>
  825. <select id="queryPayFeeDetailCount" parameterType="Map" resultType="Map">
  826. select count(1) count,SUM(receivedAmount) totalReceivedAmount,SUM(receivableAmount) totalReceivableAmount
  827. from (
  828. select pfc.fee_name feeName,f.floor_num floorNum,bu.unit_num unitNum,br.room_num roomNum,oc.car_num carNum,
  829. pf.payer_obj_type payerObjType,t.start_time startTime,t.end_time endTime,t.create_time createTime,
  830. t.receivable_amount receivableAmount,t.received_amount receivedAmount,d.name
  831. from pay_fee_detail t
  832. INNER JOIN pay_fee pf on t.fee_id = pf.fee_id and pf.status_cd = '0'
  833. inner join pay_fee_config pfc on pf.config_id = pfc.config_id and pfc.status_cd = '0'
  834. left join building_room br on pf.payer_obj_id = br.room_id and pf.payer_obj_type = '3333' and br.status_cd = '0'
  835. left join building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0'
  836. left join f_floor f on bu.floor_id = f.floor_id and f.status_cd = '0'
  837. left join owner_car oc on pf.payer_obj_id = oc.car_id and oc.status_cd = '0' and oc.car_type_cd='1001'
  838. left join pay_fee_attrs pfa on t.fee_id = pfa.fee_id and pfa.spec_cd = '390002'
  839. left join pay_fee_detail_discount pfdd on t.detail_id = pfdd.detail_id and pfdd.status_cd = '0'
  840. left join fee_discount fd on pfdd.discount_id = fd.discount_id and fd.status_cd = '0'
  841. left join fee_discount_rule fdr on fd.rule_id = fdr.rule_id and fdr.status_cd = '0'
  842. left join t_dict d on t.prime_rate = d.status_cd and d.table_name="pay_fee_detail" and
  843. d.table_columns="prime_rate"
  844. where t.status_cd = '0'
  845. <if test="roomNum !=null and roomNum != ''">
  846. and br.room_num= #{roomNum}
  847. </if>
  848. <if test="unitId !=null and unitId != ''">
  849. and bu.unit_id= #{unitId}
  850. </if>
  851. <if test="floorId !=null and floorId != ''">
  852. and f.floor_id = #{floorId}
  853. </if>
  854. <if test="objName !=null and objName != ''">
  855. and t.obj_name= #{objName}
  856. </if>
  857. <if test="feeYear !=null and feeYear != ''">
  858. and t.fee_year= #{feeYear}
  859. </if>
  860. <if test="feeMonth !=null and feeMonth != ''">
  861. and t.fee_month= #{feeMonth}
  862. </if>
  863. <if test="feeId !=null and feeId != ''">
  864. and t.fee_id= #{feeId}
  865. </if>
  866. <if test="configId !=null and configId != ''">
  867. and pfc.config_id= #{configId}
  868. </if>
  869. <if test="objId !=null and objId != ''">
  870. and t.obj_id= #{objId}
  871. </if>
  872. <if test="feeName !=null and feeName != ''">
  873. and t.fee_name= #{feeName}
  874. </if>
  875. <if test="communityId !=null and communityId != ''">
  876. and t.community_id= #{communityId}
  877. </if>
  878. <if test="primeRate != null and primeRate != ''">
  879. and t.prime_rate = #{primeRate}
  880. </if>
  881. <if test="startTime !=null">
  882. and t.create_time &gt;= #{startTime}
  883. </if>
  884. <if test="endTime !=null">
  885. and t.create_time &lt;= #{endTime}
  886. </if>
  887. ) t
  888. </select>
  889. <!-- 查询费用月统计信息 add by wuxw 2018-07-03 -->
  890. <select id="queryPayFeeDetail" parameterType="Map" resultType="Map">
  891. select pfc.fee_name feeName,f.floor_num floorNum,bu.unit_num unitNum,br.room_num roomNum,oc.car_num carNum,
  892. pf.payer_obj_type payerObjType,t.start_time startTime,t.end_time endTime,t.create_time createTime,
  893. t.receivable_amount receivableAmount,t.received_amount receivedAmount,pfa.`value`
  894. importFeeName,t.prime_rate,d.name primeRate,fdr.discount_small_type discountSmallType,fdr.rule_name
  895. ruleName,pfdd.discount_price discountPrice,co.contract_code contractCode,pfo.`value` ownerName
  896. from pay_fee_detail t
  897. INNER JOIN pay_fee pf on t.fee_id = pf.fee_id and pf.status_cd = '0'
  898. inner join pay_fee_config pfc on pf.config_id = pfc.config_id and pfc.status_cd = '0'
  899. left join building_room br on pf.payer_obj_id = br.room_id and pf.payer_obj_type = '3333' and br.status_cd = '0'
  900. left join building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0'
  901. left join f_floor f on bu.floor_id = f.floor_id and f.status_cd = '0'
  902. left join owner_car oc on pf.payer_obj_id = oc.car_id and oc.status_cd = '0' and oc.car_type_cd='1001'
  903. left join pay_fee_attrs pfa on t.fee_id = pfa.fee_id and pfa.spec_cd = '390002'
  904. left join pay_fee_attrs pfo on t.fee_id = pfo.fee_id and pfo.spec_cd = '390008'
  905. left join pay_fee_detail_discount pfdd on t.detail_id = pfdd.detail_id and pfdd.status_cd = '0'
  906. left join fee_discount fd on pfdd.discount_id = fd.discount_id and fd.status_cd = '0'
  907. left join fee_discount_rule fdr on fd.rule_id = fdr.rule_id and fdr.status_cd = '0'
  908. left join t_dict d on t.prime_rate = d.status_cd and d.table_name="pay_fee_detail" and d.table_columns="prime_rate"
  909. LEFT JOIN contract co on pf.payer_obj_id = co.contract_id and co.status_cd = '0' and pf.payer_obj_type='7777'
  910. where t.status_cd = '0'
  911. <if test="roomNum !=null and roomNum != ''">
  912. and br.room_num= #{roomNum}
  913. </if>
  914. <if test="unitId !=null and unitId != ''">
  915. and bu.unit_id= #{unitId}
  916. </if>
  917. <if test="floorId !=null and floorId != ''">
  918. and f.floor_id = #{floorId}
  919. </if>
  920. <if test="objName !=null and objName != ''">
  921. and t.obj_name= #{objName}
  922. </if>
  923. <if test="feeYear !=null and feeYear != ''">
  924. and t.fee_year= #{feeYear}
  925. </if>
  926. <if test="feeMonth !=null and feeMonth != ''">
  927. and t.fee_month= #{feeMonth}
  928. </if>
  929. <if test="feeId !=null and feeId != ''">
  930. and t.fee_id= #{feeId}
  931. </if>
  932. <if test="configId !=null and configId != ''">
  933. and pfc.config_id= #{configId}
  934. </if>
  935. <if test="objId !=null and objId != ''">
  936. and t.obj_id= #{objId}
  937. </if>
  938. <if test="feeName !=null and feeName != ''">
  939. and t.fee_name= #{feeName}
  940. </if>
  941. <if test="communityId !=null and communityId != ''">
  942. and t.community_id= #{communityId}
  943. </if>
  944. <if test="primeRate != null and primeRate != ''">
  945. and t.prime_rate = #{primeRate}
  946. </if>
  947. <if test="startTime !=null">
  948. and t.create_time &gt;= #{startTime}
  949. </if>
  950. <if test="endTime !=null">
  951. and t.create_time &lt;= #{endTime}
  952. </if>
  953. order by t.create_time desc
  954. <if test="page != -1 and page != null ">
  955. limit #{page}, #{row}
  956. </if>
  957. </select>
  958. <select id="queryAllPayFeeDetail" parameterType="Map" resultType="Map">
  959. select SUM(t.receivable_amount) allReceivableAmount,SUM(t.received_amount) allReceivedAmount
  960. from pay_fee_detail t
  961. INNER JOIN pay_fee pf on t.fee_id = pf.fee_id and pf.status_cd = '0'
  962. inner join pay_fee_config pfc on pf.config_id = pfc.config_id and pfc.status_cd = '0'
  963. left join building_room br on pf.payer_obj_id = br.room_id and pf.payer_obj_type = '3333' and br.status_cd = '0'
  964. left join building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0'
  965. left join f_floor f on bu.floor_id = f.floor_id and f.status_cd = '0'
  966. left join owner_car oc on pf.payer_obj_id = oc.car_id and oc.status_cd = '0' and oc.car_type_cd='1001'
  967. left join pay_fee_attrs pfa on t.fee_id = pfa.fee_id and pfa.spec_cd = '390002'
  968. where t.status_cd = '0'
  969. <if test="roomNum !=null and roomNum != ''">
  970. and br.room_num= #{roomNum}
  971. </if>
  972. <if test="unitId !=null and unitId != ''">
  973. and bu.unit_id= #{unitId}
  974. </if>
  975. <if test="floorId !=null and floorId != ''">
  976. and f.floor_id = #{floorId}
  977. </if>
  978. <if test="objName !=null and objName != ''">
  979. and t.obj_name= #{objName}
  980. </if>
  981. <if test="feeYear !=null and feeYear != ''">
  982. and t.fee_year= #{feeYear}
  983. </if>
  984. <if test="feeMonth !=null and feeMonth != ''">
  985. and t.fee_month= #{feeMonth}
  986. </if>
  987. <if test="feeId !=null and feeId != ''">
  988. and t.fee_id= #{feeId}
  989. </if>
  990. <if test="configId !=null and configId != ''">
  991. and pfc.config_id= #{configId}
  992. </if>
  993. <if test="objId !=null and objId != ''">
  994. and t.obj_id= #{objId}
  995. </if>
  996. <if test="feeName !=null and feeName != ''">
  997. and t.fee_name= #{feeName}
  998. </if>
  999. <if test="communityId !=null and communityId != ''">
  1000. and t.community_id= #{communityId}
  1001. </if>
  1002. <if test="primeRate != null and primeRate != ''">
  1003. and t.prime_rate = #{primeRate}
  1004. </if>
  1005. <if test="startTime !=null">
  1006. and t.create_time &gt;= #{startTime}
  1007. </if>
  1008. <if test="endTime !=null">
  1009. and t.create_time &lt;= #{endTime}
  1010. </if>
  1011. </select>
  1012. <select id="queryPayFeeDetailSum" parameterType="Map" resultType="Map">
  1013. select pfc.fee_name feeName,f.floor_num floorNum,bu.unit_num unitNum,br.room_num roomNum,oc.car_num carNum,
  1014. pf.payer_obj_type payerObjType,t.start_time startTime,t.end_time endTime,t.create_time createTime,
  1015. t.receivable_amount receivableAmount,t.received_amount receivedAmount,pfa.`value`
  1016. importFeeName,t.prime_rate,d.name primeRate,fdr.discount_small_type discountSmallType,fdr.rule_name
  1017. ruleName,pfdd.discount_price,
  1018. SUM(pfdd.discount_price) discountPrice
  1019. from pay_fee_detail t
  1020. INNER JOIN pay_fee pf on t.fee_id = pf.fee_id and pf.status_cd = '0'
  1021. inner join pay_fee_config pfc on pf.config_id = pfc.config_id and pfc.status_cd = '0'
  1022. left join building_room br on pf.payer_obj_id = br.room_id and pf.payer_obj_type = '3333' and br.status_cd = '0'
  1023. left join building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0'
  1024. left join f_floor f on bu.floor_id = f.floor_id and f.status_cd = '0'
  1025. left join owner_car oc on pf.payer_obj_id = oc.car_id and oc.status_cd = '0' and oc.car_type_cd='1001'
  1026. left join pay_fee_attrs pfa on t.fee_id = pfa.fee_id and pfa.spec_cd = '390002'
  1027. left join pay_fee_detail_discount pfdd on t.detail_id = pfdd.detail_id and pfdd.status_cd = '0'
  1028. left join fee_discount fd on pfdd.discount_id = fd.discount_id and fd.status_cd = '0'
  1029. left join fee_discount_rule fdr on fd.rule_id = fdr.rule_id and fdr.status_cd = '0'
  1030. left join t_dict d on t.prime_rate = d.status_cd and d.table_name="pay_fee_detail" and
  1031. d.table_columns="prime_rate"
  1032. where t.status_cd = '0'
  1033. <if test="roomNum !=null and roomNum != ''">
  1034. and br.room_num= #{roomNum}
  1035. </if>
  1036. <if test="unitId !=null and unitId != ''">
  1037. and bu.unit_id= #{unitId}
  1038. </if>
  1039. <if test="floorId !=null and floorId != ''">
  1040. and f.floor_id = #{floorId}
  1041. </if>
  1042. <if test="objName !=null and objName != ''">
  1043. and t.obj_name= #{objName}
  1044. </if>
  1045. <if test="feeYear !=null and feeYear != ''">
  1046. and t.fee_year= #{feeYear}
  1047. </if>
  1048. <if test="feeMonth !=null and feeMonth != ''">
  1049. and t.fee_month= #{feeMonth}
  1050. </if>
  1051. <if test="feeId !=null and feeId != ''">
  1052. and t.fee_id= #{feeId}
  1053. </if>
  1054. <if test="configId !=null and configId != ''">
  1055. and pfc.config_id= #{configId}
  1056. </if>
  1057. <if test="objId !=null and objId != ''">
  1058. and t.obj_id= #{objId}
  1059. </if>
  1060. <if test="feeName !=null and feeName != ''">
  1061. and t.fee_name= #{feeName}
  1062. </if>
  1063. <if test="communityId !=null and communityId != ''">
  1064. and t.community_id= #{communityId}
  1065. </if>
  1066. <if test="primeRate != null and primeRate != ''">
  1067. and t.prime_rate = #{primeRate}
  1068. </if>
  1069. <if test="startTime !=null">
  1070. and t.create_time &gt;= #{startTime}
  1071. </if>
  1072. <if test="endTime !=null">
  1073. and t.create_time &lt;= #{endTime}
  1074. </if>
  1075. group by fdr.discount_small_type
  1076. order by t.create_time desc
  1077. </select>
  1078. <select id="queryDeadlineFeeCount" parameterType="Map" resultType="Map">
  1079. select count(1) count
  1080. from (
  1081. SELECT
  1082. t.obj_name objName,
  1083. t.fee_name feeName,
  1084. t.deadline_time deadlineTime
  1085. FROM
  1086. report_fee_month_statistics t
  1087. inner join pay_fee_config pfc on t.config_id = pfc.config_id and pfc.status_cd = '0'
  1088. left join building_room br on t.obj_id = br.room_id and t.obj_type = '3333' and br.status_cd = '0'
  1089. left join building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0'
  1090. left join f_floor f on bu.floor_id = f.floor_id and f.status_cd = '0'
  1091. inner join pay_fee pf on t.fee_id = pf.fee_id and pf.community_id = t.community_id and pf.status_cd = '0'
  1092. where t.status_cd = '0'
  1093. <if test="roomNum !=null and roomNum != ''">
  1094. and br.room_num= #{roomNum}
  1095. </if>
  1096. <if test="unitId !=null and unitId != ''">
  1097. and bu.unit_id= #{unitId}
  1098. </if>
  1099. <if test="floorId !=null and floorId != ''">
  1100. and f.floor_id = #{floorId}
  1101. </if>
  1102. <if test="objName !=null and objName != ''">
  1103. and t.obj_name= #{objName}
  1104. </if>
  1105. <if test="feeYear !=null and feeYear != ''">
  1106. and t.fee_year= #{feeYear}
  1107. </if>
  1108. <if test="feeMonth !=null and feeMonth != ''">
  1109. and t.fee_month= #{feeMonth}
  1110. </if>
  1111. <if test="feeId !=null and feeId != ''">
  1112. and t.fee_id= #{feeId}
  1113. </if>
  1114. <if test="configId !=null and configId != ''">
  1115. and t.config_id= #{configId}
  1116. </if>
  1117. <if test="objId !=null and objId != ''">
  1118. and t.obj_id= #{objId}
  1119. </if>
  1120. <if test="feeName !=null and feeName != ''">
  1121. and t.fee_name= #{feeName}
  1122. </if>
  1123. <if test="communityId !=null and communityId != ''">
  1124. and t.community_id= #{communityId}
  1125. </if>
  1126. <if test="startTime !=null">
  1127. and t.deadline_time &gt;= #{startTime}
  1128. </if>
  1129. <if test="endTime !=null">
  1130. and t.deadline_time &lt;= #{endTime}
  1131. </if>
  1132. ) t
  1133. </select>
  1134. <!-- 查询费用月统计信息 add by wuxw 2018-07-03 -->
  1135. <select id="queryDeadlineFee" parameterType="Map" resultType="Map">
  1136. SELECT
  1137. t.obj_name objName,
  1138. t.fee_name feeName,
  1139. t.deadline_time deadlineTime
  1140. FROM
  1141. report_fee_month_statistics t
  1142. inner join pay_fee_config pfc on t.config_id = pfc.config_id and pfc.status_cd = '0'
  1143. left join building_room br on t.obj_id = br.room_id and t.obj_type = '3333' and br.status_cd = '0'
  1144. left join building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0'
  1145. left join f_floor f on bu.floor_id = f.floor_id and f.status_cd = '0'
  1146. inner join pay_fee pf on t.fee_id = pf.fee_id and pf.community_id = t.community_id and pf.status_cd = '0'
  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 t.config_id= #{configId}
  1171. </if>
  1172. <if test="objId !=null and objId != ''">
  1173. and t.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="startTime !=null">
  1182. and t.deadline_time &gt;= #{startTime}
  1183. </if>
  1184. <if test="endTime !=null">
  1185. and t.deadline_time &lt;= #{endTime}
  1186. </if>
  1187. order by t.deadline_time
  1188. <if test="page != -1 and page != null ">
  1189. limit #{page}, #{row}
  1190. </if>
  1191. </select>
  1192. <select id="queryPrePaymentNewCount" parameterType="Map" resultType="Map">
  1193. select count(1) count
  1194. from (
  1195. select pfc.fee_name feeName, f.floor_num floorNum,bu.unit_num unitNum,br.room_num roomNum,t.end_time endTime
  1196. ,oc.car_num carNum
  1197. from pay_fee t
  1198. inner join pay_fee_config pfc on t.config_id = pfc.config_id and pfc.status_cd = '0'
  1199. left join building_room br on t.payer_obj_id = br.room_id and t.payer_obj_type = '3333' and br.status_cd = '0'
  1200. left join building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0'
  1201. left join f_floor f on f.floor_id = bu.floor_id and f.status_cd = '0'
  1202. 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 oc.car_type_cd='1001'
  1203. where t.state = '2008001'
  1204. and t.status_cd = '0'
  1205. <if test="communityId !=null and communityId != ''">
  1206. and t.community_id= #{communityId}
  1207. </if>
  1208. <if test="startTime !=null">
  1209. and t.end_time &gt;= #{startTime}
  1210. </if>
  1211. <if test="endTime !=null">
  1212. and t.end_time &lt;= #{endTime}
  1213. </if>
  1214. ) t
  1215. </select>
  1216. <!-- 查询费用月统计信息 add by wuxw 2018-07-03 -->
  1217. <select id="queryPrePayment" parameterType="Map" resultType="Map">
  1218. select pfc.fee_name feeName, f.floor_num floorNum,bu.unit_num unitNum,br.room_num roomNum,t.end_time endTime ,
  1219. oc.car_num carNum,t.payer_obj_type payerObjType
  1220. from pay_fee t
  1221. inner join pay_fee_config pfc on t.config_id = pfc.config_id and pfc.status_cd = '0'
  1222. left join building_room br on t.payer_obj_id = br.room_id and t.payer_obj_type = '3333' and br.status_cd = '0'
  1223. left join building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0'
  1224. left join f_floor f on f.floor_id = bu.floor_id and f.status_cd = '0'
  1225. 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 oc.car_type_cd='1001'
  1226. where t.state = '2008001'
  1227. and t.status_cd = '0'
  1228. <if test="communityId !=null and communityId != ''">
  1229. and t.community_id= #{communityId}
  1230. </if>
  1231. <if test="startTime !=null">
  1232. and t.end_time &gt;= #{startTime}
  1233. </if>
  1234. <if test="endTime !=null">
  1235. and t.end_time &lt;= #{endTime}
  1236. </if>
  1237. <if test="page != -1 and page != null ">
  1238. limit #{page}, #{row}
  1239. </if>
  1240. </select>
  1241. <select id="queryPrePaymentCount" parameterType="Map" resultType="Map">
  1242. select pfc.fee_name feeName,count(t.payer_obj_id) objCount from pay_fee t
  1243. inner join pay_fee_config pfc on t.config_id = pfc.config_id and pfc.status_cd = '0'
  1244. where t.state = '2008001'
  1245. and t.status_cd = '0'
  1246. and t.end_time &gt; #{startTime}
  1247. and t.end_time &lt; #{endTime}
  1248. and t.community_id= #{communityId}
  1249. group by pfc.fee_name ,pfc.config_id
  1250. order by objCount
  1251. </select>
  1252. <select id="queryDeadlinePaymentCount" parameterType="Map" resultType="Map">
  1253. SELECT
  1254. t.fee_name feeName,
  1255. count(t.obj_id) objCount
  1256. FROM
  1257. report_fee_month_statistics t
  1258. inner join pay_fee pf on t.fee_id = pf.fee_id and pf.community_id = t.community_id and pf.status_cd = '0'
  1259. WHERE
  1260. 1 = 1
  1261. AND t.status_cd = '0'
  1262. and t.community_id= #{communityId}
  1263. AND t.deadline_time &gt; #{startTime}
  1264. AND t.deadline_time &lt; #{endTime}
  1265. group by t.config_id,t.fee_name
  1266. order by objCount desc
  1267. </select>
  1268. <select id="queryOwePaymentCount" parameterType="Map" resultType="Map">
  1269. select t.fee_name feeName,count( distinct t.obj_id) objCount
  1270. from report_fee_month_statistics t
  1271. inner join pay_fee pf on t.fee_id = pf.fee_id and pf.community_id = t.community_id and pf.status_cd = '0'
  1272. where t.community_id = #{communityId}
  1273. and t.owe_amount > 0
  1274. group by t.config_id,t.fee_name
  1275. order by objCount desc
  1276. </select>
  1277. <select id="queryAllPaymentCount" parameterType="Map" resultType="Map">
  1278. select t.fee_name feeName,count(distinct t.obj_id) objCount
  1279. from report_fee_month_statistics t
  1280. inner join pay_fee pf on t.fee_id = pf.fee_id and pf.community_id = t.community_id and pf.status_cd = '0'
  1281. where t.community_id = #{communityId}
  1282. group by t.config_id,t.fee_name
  1283. order by objCount desc
  1284. </select>
  1285. <select id="queryFinishOweFee" parameterType="Map" resultType="Map">
  1286. select t.config_id configId, t.fee_id feeId,t.statistics_id statisticsId,t.fee_year feeYear,fee_month feeMonth
  1287. from report_fee_month_statistics t
  1288. inner join pay_fee pf on t.fee_id = pf.fee_id and pf.state = '2009001' and pf.community_id = #{communityId} and
  1289. pf.status_cd = '0'
  1290. where t.owe_amount > 0
  1291. and t.status_cd = '0'
  1292. and t.community_id = #{communityId}
  1293. limit 100
  1294. </select>
  1295. <!-- 查询费用配置信息 add by wuxw 2018-07-03 -->
  1296. <select id="getFeeConfigInfo" parameterType="Map" resultType="Map">
  1297. select t.fee_type_cd,t.fee_type_cd feeTypeCd,t.computing_formula,t.computing_formula
  1298. computingFormula,t.additional_amount,t.additional_amount additionalAmount,t.status_cd,t.status_cd
  1299. statusCd,t.square_price,t.square_price squarePrice,t.is_default,t.is_default isDefault,t.config_id,t.config_id
  1300. configId,t.fee_flag,t.fee_flag feeFlag,t.fee_name,t.fee_name feeName,t.start_time,t.start_time
  1301. startTime,t.end_time,t.end_time endTime,t.community_id,t.community_id communityId,t.b_id,t.b_id bId,
  1302. td1.name feeTypeCdName,td2.name feeFlagName,t.bill_type billType,t.bill_type,td3.name billTypeName,
  1303. t.payment_cd,t.payment_cycle,t.payment_cd paymentCd,t.payment_cycle paymentCycle
  1304. from pay_fee_config t,t_dict td1,t_dict td2,t_dict td3
  1305. where 1 =1
  1306. and t.fee_type_cd = td1.status_cd
  1307. and td1.table_name = 'pay_fee_config'
  1308. and td1.table_columns = 'fee_type_cd'
  1309. and t.fee_flag = td2.status_cd
  1310. and td2.table_name = 'pay_fee_config'
  1311. and td2.table_columns = 'fee_flag'
  1312. and t.bill_type = td3.status_cd
  1313. and td3.table_name = 'pay_fee_config'
  1314. and td3.table_columns = 'bill_type'
  1315. and t.is_default = 'F'
  1316. and t.status_cd = '0'
  1317. <if test="feeTypeCd !=null and feeTypeCd != ''">
  1318. and t.fee_type_cd= #{feeTypeCd}
  1319. </if>
  1320. <if test="computingFormula !=null and computingFormula != ''">
  1321. and t.computing_formula= #{computingFormula}
  1322. </if>
  1323. <if test="additionalAmount !=null and additionalAmount != ''">
  1324. and t.additional_amount= #{additionalAmount}
  1325. </if>
  1326. <if test="squarePrice !=null and squarePrice != ''">
  1327. and t.square_price= #{squarePrice}
  1328. </if>
  1329. <if test="configId !=null and configId != ''">
  1330. and t.config_id= #{configId}
  1331. </if>
  1332. <if test="feeFlag !=null and feeFlag != ''">
  1333. and t.fee_flag= #{feeFlag}
  1334. </if>
  1335. <if test="feeName !=null and feeName != ''">
  1336. and t.fee_name like '%${feeName}%'
  1337. </if>
  1338. <if test="startTime !=null ">
  1339. and t.start_time= #{startTime}
  1340. </if>
  1341. <if test="endTime !=null ">
  1342. and t.end_time= #{endTime}
  1343. </if>
  1344. <if test="valid !=null and valid == 1">
  1345. and t.end_time &gt; now()
  1346. </if>
  1347. <if test="curTime !=null ">
  1348. and t.end_time &gt; #{curTime}
  1349. and t.start_time &lt; #{curTime}
  1350. </if>
  1351. <if test="communityId !=null and communityId != ''">
  1352. and t.community_id= #{communityId}
  1353. </if>
  1354. <if test="bId !=null and bId != ''">
  1355. and t.b_id= #{bId}
  1356. </if>
  1357. <if test="paymentCd !=null and paymentCd != ''">
  1358. and t.payment_cd= #{paymentCd}
  1359. </if>
  1360. <if test="paymentCycle !=null and paymentCycle != ''">
  1361. and t.payment_cycle= #{paymentCycle}
  1362. </if>
  1363. <if test="billType !=null and billType != ''">
  1364. and t.bill_type= #{billType}
  1365. </if>
  1366. order by t.create_time desc
  1367. <if test="page != -1 and page != null ">
  1368. limit #{page}, #{row}
  1369. </if>
  1370. </select>
  1371. <select id="getRepairInfo" parameterType="Map" resultType="Map">
  1372. select r.staff_id staffId,r.staff_name staffName,r.state, t.name stateName, count(*) amount from r_repair_user r
  1373. left join t_dict t on t.table_name="r_repair_user" and t.table_columns="state" and t.status_cd=r.state
  1374. where r.state != "10005" and r.status_cd = "0"
  1375. <if test="ruId != null and ruId != ''">
  1376. and r.ru_id = #{ruId}
  1377. </if>
  1378. <if test="repairId != null and repairId != ''">
  1379. and r.repair_id = #{repairId}
  1380. </if>
  1381. <if test="communityId != null and communityId !=''">
  1382. and r.community_id = #{communityId}
  1383. </if>
  1384. <if test="bId != null and bId !=''">
  1385. and r.b_id = #{bId}
  1386. </if>
  1387. <if test="state != null and state != ''">
  1388. and r.state = #{state}
  1389. </if>
  1390. <if test="context != null and context !=''">
  1391. and r.context = #{context}
  1392. </if>
  1393. <if test="statusCd != null and statusCd != ''">
  1394. and r.status_cd = #{statusCd}
  1395. </if>
  1396. <if test="staffId != null and staffId !=''">
  1397. and r.staff_id = #{staffId}
  1398. </if>
  1399. <if test="staffName != null and staffName !=''">
  1400. and r.staff_name = #{staffName}
  1401. </if>
  1402. <if test="preStaffId != null and preStaffId !=''">
  1403. and r.pre_staff_id = #{preStaffId}
  1404. </if>
  1405. <if test="preStaffName != null and preStaffName !=''">
  1406. and r.pre_staff_name = #{preStaffName}
  1407. </if>
  1408. <if test="beginStartTime != null and beginStartTime !=''">
  1409. and r.start_time &gt;= #{beginStartTime}
  1410. </if>
  1411. <if test="beginEndTime != null and beginEndTime !=''">
  1412. and r.start_time &lt;= #{beginEndTime}
  1413. </if>
  1414. <if test="finishStartTime != null and finishStartTime !=''">
  1415. and r.end_time &gt;= #{finishStartTime}
  1416. </if>
  1417. <if test="finishEndTime != null and finishEndTime !=''">
  1418. and r.end_time &lt;= #{finishEndTime}
  1419. </if>
  1420. <if test="createTime != null and createTime !=''">
  1421. and r.create_time = #{createTime}
  1422. </if>
  1423. group by r.staff_id,r.state
  1424. order by r.create_time desc
  1425. <if test="page != -1 and page != null ">
  1426. limit #{page}, #{row}
  1427. </if>
  1428. </select>
  1429. <select id="getRepairWithOutPage" parameterType="Map" resultType="Map">
  1430. select r.staff_id staffId,r.staff_name staffName,r.state, t.name stateName, count(*) amount from r_repair_user r
  1431. left join t_dict t on t.table_name="r_repair_user" and t.table_columns="state" and t.status_cd=r.state
  1432. where r.state != "10005" and r.status_cd = "0"
  1433. <if test="ruId != null and ruId != ''">
  1434. and r.ru_id = #{ruId}
  1435. </if>
  1436. <if test="repairId != null and repairId != ''">
  1437. and r.repair_id = #{repairId}
  1438. </if>
  1439. <if test="communityId != null and communityId !=''">
  1440. and r.community_id = #{communityId}
  1441. </if>
  1442. <if test="bId != null and bId !=''">
  1443. and r.b_id = #{bId}
  1444. </if>
  1445. <if test="state != null and state != ''">
  1446. and r.state = #{state}
  1447. </if>
  1448. <if test="context != null and context !=''">
  1449. and r.context = #{context}
  1450. </if>
  1451. <if test="statusCd != null and statusCd != ''">
  1452. and r.status_cd = #{statusCd}
  1453. </if>
  1454. <if test="staffId != null and staffId !=''">
  1455. and r.staff_id = #{staffId}
  1456. </if>
  1457. <if test="staffName != null and staffName !=''">
  1458. and r.staff_name = #{staffName}
  1459. </if>
  1460. <if test="preStaffId != null and preStaffId !=''">
  1461. and r.pre_staff_id = #{preStaffId}
  1462. </if>
  1463. <if test="preStaffName != null and preStaffName !=''">
  1464. and r.pre_staff_name = #{preStaffName}
  1465. </if>
  1466. <if test="beginStartTime != null and beginStartTime !=''">
  1467. and r.start_time &gt;= #{beginStartTime}
  1468. </if>
  1469. <if test="beginEndTime != null and beginEndTime !=''">
  1470. and r.start_time &lt;= #{beginEndTime}
  1471. </if>
  1472. <if test="finishStartTime != null and finishStartTime !=''">
  1473. and r.end_time &gt;= #{finishStartTime}
  1474. </if>
  1475. <if test="finishEndTime != null and finishEndTime !=''">
  1476. and r.end_time &lt;= #{finishEndTime}
  1477. </if>
  1478. <if test="createTime != null and createTime !=''">
  1479. and r.create_time = #{createTime}
  1480. </if>
  1481. group by r.staff_id,r.state
  1482. order by r.create_time desc
  1483. </select>
  1484. <select id="queryRepairForStaff" parameterType="Map" resultType="Map">
  1485. SELECT r.staff_id staffId,r.staff_name staffName FROM r_repair_user r
  1486. WHERE r.state!='10005' AND
  1487. r.repair_event!='payUser' AND r.repair_event!="startUser" AND r.staff_id != '-1'
  1488. <if test="communityId != null and communityId !=''">
  1489. and r.community_id = #{communityId}
  1490. </if>
  1491. <if test="staffId != null and staffId != ''">
  1492. and r.staff_id = #{staffId}
  1493. </if>
  1494. group by r.staff_id
  1495. order by r.create_time desc
  1496. <if test="page != -1 and page != null ">
  1497. limit #{page}, #{row}
  1498. </if>
  1499. </select>
  1500. <select id="getReceivableInformation" parameterType="Map" resultType="Map">
  1501. select sum(t.receivable_amount) receivableAmount,SUM(t.received_amount) receivedAmount,SUM(t.owe_amount)
  1502. oweAmount
  1503. from report_fee_month_statistics t
  1504. inner join pay_fee pf on t.fee_id = pf.fee_id and pf.status_cd = '0'
  1505. where t.community_id = #{communityId}
  1506. </select>
  1507. <select id="getFloorReceivableInformation" parameterType="Map" resultType="Map">
  1508. select f.floor_num floorNum,f.`name`,sum(t.receivable_amount) receivableAmount,SUM(t.received_amount) receivedAmount,SUM(t.owe_amount) oweAmount
  1509. from report_fee_month_statistics t
  1510. inner join pay_fee pf on t.fee_id = pf.fee_id and pf.status_cd = '0'
  1511. inner join building_room br on br.room_id = t.obj_id and t.obj_type = '3333' and br.community_id = t.community_id and br.status_cd = '0'
  1512. inner join building_unit bu on bu.unit_id = br.unit_id and bu.status_cd = '0'
  1513. inner join f_floor f on f.floor_id = bu.floor_id and f.status_cd = '0'
  1514. where t.community_id = #{communityId}
  1515. group by f.floor_num ,f.`name`
  1516. </select>
  1517. <select id="getFeeConfigReceivableInformation" parameterType="Map" resultType="Map">
  1518. select t.fee_name feeName,sum(t.receivable_amount) receivableAmount,SUM(t.received_amount) receivedAmount,SUM(t.owe_amount) oweAmount
  1519. from report_fee_month_statistics t
  1520. inner join pay_fee pf on t.fee_id = pf.fee_id and pf.status_cd = '0'
  1521. where t.community_id = #{communityId}
  1522. group by t.fee_name
  1523. </select>
  1524. <!-- 查询未收费房屋统计数量 add by wuxw 2018-07-03 -->
  1525. <select id="queryNoFeeRoomsCount" parameterType="Map" resultType="Map">
  1526. select count(1) count
  1527. from building_room t
  1528. inner join building_unit bu on t.unit_id = bu.unit_id and bu.status_cd = '0'
  1529. inner join f_floor f on bu.floor_id = f.floor_id and f.status_cd = '0'
  1530. where t.status_cd = '0'
  1531. and not exists(
  1532. select 1 from pay_fee pf where t.room_id = pf.payer_obj_id and pf.status_cd = '0' and pf.state = '2008001'
  1533. )
  1534. and t.community_id = #{communityId}
  1535. </select>
  1536. <!-- 查询费用月统计信息 add by wuxw 2018-07-03 -->
  1537. <select id="queryNoFeeRooms" parameterType="Map" resultType="Map">
  1538. select f.floor_num floorNum,bu.unit_num unitNum,t.room_num roomNum,t.room_id roomId,bo.owner_id ownerId,bo.name ownerName,bo.link
  1539. from building_room t
  1540. inner join building_unit bu on t.unit_id = bu.unit_id and bu.status_cd = '0'
  1541. inner join f_floor f on bu.floor_id = f.floor_id and f.status_cd = '0'
  1542. left join building_owner_room_rel borr on borr.room_id = t.room_id and borr.status_cd ='0'
  1543. left join building_owner bo on borr.owner_id = bo.member_id and bo.status_cd = '0'
  1544. where t.status_cd = '0'
  1545. and not exists(
  1546. select 1 from pay_fee pf where t.room_id = pf.payer_obj_id and pf.status_cd = '0' and pf.state = '2008001'
  1547. )
  1548. and t.community_id = #{communityId}
  1549. order by t.create_time desc
  1550. <if test="page != -1 and page != null ">
  1551. limit #{page}, #{row}
  1552. </if>
  1553. </select>
  1554. </mapper>