ReportOweFeeServiceDaoImplMapper.xml 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  3. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  4. <mapper namespace="reportOweFeeServiceDaoImpl">
  5. <!-- 保存欠费统计信息 add by wuxw 2018-07-03 -->
  6. <insert id="saveReportOweFeeInfo" parameterType="Map">
  7. insert into report_owe_fee(
  8. config_name,deadline_time,owner_tel,update_time,owe_id,owner_id,fee_id,amount_owed,payer_obj_name,owner_name,config_id,fee_name,end_time,community_id,payer_obj_type,payer_obj_id
  9. ) values (
  10. #{configName},#{deadlineTime},#{ownerTel},#{updateTime},#{oweId},#{ownerId},#{feeId},#{amountOwed},#{payerObjName},#{ownerName},#{configId},#{feeName},#{endTime},#{communityId},#{payerObjType},#{payerObjId}
  11. )
  12. </insert>
  13. <!-- 查询欠费统计信息 add by wuxw 2018-07-03 -->
  14. <select id="getReportOweFeeInfo" parameterType="Map" resultType="Map">
  15. select distinct(t.payer_obj_id) payerObjId
  16. from report_owe_fee t
  17. LEFT JOIN pay_fee pf on t.fee_id = pf.fee_id
  18. LEFT JOIN building_room br on pf.payer_obj_id = br.room_id and br.status_cd = '0'
  19. LEFT JOIN building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0'
  20. where 1 =1
  21. and pf.status_cd = '0'
  22. <if test="roomSubType !=null and roomSubType != ''">
  23. and br.room_sub_type = #{roomSubType}
  24. </if>
  25. <if test="roomNum !=null and roomNum != ''">
  26. and br.room_num = #{roomNum}
  27. </if>
  28. <if test="floorId !=null and floorId != ''">
  29. and bu.floor_id = #{floorId}
  30. </if>
  31. <if test="unitId !=null and unitId != ''">
  32. and bu.unit_id = #{unitId}
  33. </if>
  34. <if test="configName !=null and configName != ''">
  35. and t.config_name= #{configName}
  36. </if>
  37. <if test="deadlineTime !=null and deadlineTime != ''">
  38. and t.deadline_time= #{deadlineTime}
  39. </if>
  40. <if test="ownerTel !=null and ownerTel != ''">
  41. and t.owner_tel= #{ownerTel}
  42. </if>
  43. <if test="updateTime !=null and updateTime != ''">
  44. and t.update_time= #{updateTime}
  45. </if>
  46. <if test="oweId !=null and oweId != ''">
  47. and t.owe_id= #{oweId}
  48. </if>
  49. <if test="ownerId !=null and ownerId != ''">
  50. and t.owner_id= #{ownerId}
  51. </if>
  52. <if test="feeId !=null and feeId != ''">
  53. and t.fee_id= #{feeId}
  54. </if>
  55. <if test="amountOwed !=null and amountOwed != ''">
  56. and t.amount_owed= #{amountOwed}
  57. </if>
  58. <if test='hasOweFee !=null and hasOweFee == "Y"'>
  59. and t.amount_owed &gt; 0
  60. </if>
  61. <if test="payerObjName !=null and payerObjName != ''">
  62. and t.payer_obj_name= #{payerObjName}
  63. </if>
  64. <if test="ownerName !=null and ownerName != ''">
  65. and t.owner_name= #{ownerName}
  66. </if>
  67. <if test="configId !=null and configId != ''">
  68. and t.config_id= #{configId}
  69. </if>
  70. <if test="configIds !=null">
  71. and t.config_id in
  72. <foreach collection="configIds" item="item" index="index" open="(" close=")" separator=",">
  73. #{item}
  74. </foreach>
  75. </if>
  76. <if test="feeName !=null and feeName != ''">
  77. and t.fee_name= #{feeName}
  78. </if>
  79. <if test="endTime !=null and endTime != ''">
  80. and t.end_time= #{endTime}
  81. </if>
  82. <if test="communityId !=null and communityId != ''">
  83. and t.community_id= #{communityId}
  84. </if>
  85. <if test="payerObjType !=null and payerObjType != ''">
  86. and t.payer_obj_type= #{payerObjType}
  87. </if>
  88. <if test="payerObjId !=null and payerObjId != ''">
  89. and t.payer_obj_id= #{payerObjId}
  90. </if>
  91. order by t.payer_obj_id
  92. <if test="page != -1 and page != null ">
  93. limit #{page}, #{row}
  94. </if>
  95. </select>
  96. <!-- 修改欠费统计信息 add by wuxw 2018-07-03 -->
  97. <update id="updateReportOweFeeInfo" parameterType="Map">
  98. update report_owe_fee t
  99. <set>
  100. <if test="configName !=null and configName != ''">
  101. t.config_name= #{configName},
  102. </if>
  103. <if test="deadlineTime !=null and deadlineTime != ''">
  104. t.deadline_time= #{deadlineTime},
  105. </if>
  106. <if test="ownerTel !=null and ownerTel != ''">
  107. t.owner_tel= #{ownerTel},
  108. </if>
  109. <if test="updateTime !=null and updateTime != ''">
  110. t.update_time= #{updateTime},
  111. </if>
  112. <if test="ownerId !=null and ownerId != ''">
  113. t.owner_id= #{ownerId},
  114. </if>
  115. <if test="feeId !=null and feeId != ''">
  116. t.fee_id= #{feeId},
  117. </if>
  118. <if test="amountOwed !=null and amountOwed != ''">
  119. t.amount_owed= #{amountOwed},
  120. </if>
  121. <if test="payerObjName !=null and payerObjName != ''">
  122. t.payer_obj_name= #{payerObjName},
  123. </if>
  124. <if test="ownerName !=null and ownerName != ''">
  125. t.owner_name= #{ownerName},
  126. </if>
  127. <if test="configId !=null and configId != ''">
  128. t.config_id= #{configId},
  129. </if>
  130. <if test="feeName !=null and feeName != ''">
  131. t.fee_name= #{feeName},
  132. </if>
  133. <if test="endTime !=null and endTime != ''">
  134. t.end_time= #{endTime},
  135. </if>
  136. <if test="communityId !=null and communityId != ''">
  137. t.community_id= #{communityId},
  138. </if>
  139. <if test="payerObjType !=null and payerObjType != ''">
  140. t.payer_obj_type= #{payerObjType},
  141. </if>
  142. <if test="payerObjId !=null and payerObjId != ''">
  143. t.payer_obj_id= #{payerObjId}
  144. </if>
  145. </set>
  146. where 1=1
  147. and t.owe_id= #{oweId}
  148. <if test="communityId !=null and communityId != ''">
  149. and t.community_id= #{communityId}
  150. </if>
  151. </update>
  152. <!-- 修改欠费统计信息 add by wuxw 2018-07-03 -->
  153. <delete id="deleteReportOweFeeInfo" parameterType="Map">
  154. delete from report_owe_fee
  155. where 1=1
  156. <if test="oweId !=null and oweId != ''">
  157. and owe_id= #{oweId}
  158. </if>
  159. <if test="feeId !=null and feeId != ''">
  160. and fee_id = #{feeId}
  161. </if>
  162. <if test="communityId !=null and communityId != ''">
  163. and community_id= #{communityId}
  164. </if>
  165. </delete>
  166. <!-- 查询欠费统计数量 add by wuxw 2018-07-03 -->
  167. <select id="queryReportOweFeesCount" parameterType="Map" resultType="Map">
  168. select count(distinct(t.payer_obj_id)) count
  169. from report_owe_fee t
  170. LEFT JOIN pay_fee pf on t.fee_id = pf.fee_id
  171. LEFT JOIN building_room br on pf.payer_obj_id = br.room_id and br.status_cd = '0'
  172. LEFT JOIN building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0'
  173. where 1 =1
  174. and pf.status_cd = '0'
  175. <if test="roomSubType !=null and roomSubType != ''">
  176. and br.room_sub_type = #{roomSubType}
  177. </if>
  178. <if test="roomNum !=null and roomNum != ''">
  179. and br.room_num = #{roomNum}
  180. </if>
  181. <if test="floorId !=null and floorId != ''">
  182. and bu.floor_id = #{floorId}
  183. </if>
  184. <if test="unitId !=null and unitId != ''">
  185. and bu.unit_id = #{unitId}
  186. </if>
  187. <if test="configName !=null and configName != ''">
  188. and t.config_name= #{configName}
  189. </if>
  190. <if test="deadlineTime !=null and deadlineTime != ''">
  191. and t.deadline_time= #{deadlineTime}
  192. </if>
  193. <if test="ownerTel !=null and ownerTel != ''">
  194. and t.owner_tel= #{ownerTel}
  195. </if>
  196. <if test="updateTime !=null and updateTime != ''">
  197. and t.update_time= #{updateTime}
  198. </if>
  199. <if test="oweId !=null and oweId != ''">
  200. and t.owe_id= #{oweId}
  201. </if>
  202. <if test="ownerId !=null and ownerId != ''">
  203. and t.owner_id= #{ownerId}
  204. </if>
  205. <if test="feeId !=null and feeId != ''">
  206. and t.fee_id= #{feeId}
  207. </if>
  208. <if test="amountOwed !=null and amountOwed != ''">
  209. and t.amount_owed= #{amountOwed}
  210. </if>
  211. <if test='hasOweFee !=null and hasOweFee == "Y"'>
  212. and t.amount_owed &gt; 0
  213. </if>
  214. <if test="payerObjName !=null and payerObjName != ''">
  215. and t.payer_obj_name= #{payerObjName}
  216. </if>
  217. <if test="ownerName !=null and ownerName != ''">
  218. and t.owner_name= #{ownerName}
  219. </if>
  220. <if test="configId !=null and configId != ''">
  221. and t.config_id= #{configId}
  222. </if>
  223. <if test="configIds !=null">
  224. and t.config_id in
  225. <foreach collection="configIds" item="item" index="index" open="(" close=")" separator=",">
  226. #{item}
  227. </foreach>
  228. </if>
  229. <if test="feeName !=null and feeName != ''">
  230. and t.fee_name= #{feeName}
  231. </if>
  232. <if test="endTime !=null and endTime != ''">
  233. and t.end_time= #{endTime}
  234. </if>
  235. <if test="communityId !=null and communityId != ''">
  236. and t.community_id= #{communityId}
  237. </if>
  238. <if test="payerObjType !=null and payerObjType != ''">
  239. and t.payer_obj_type= #{payerObjType}
  240. </if>
  241. <if test="payerObjId !=null and payerObjId != ''">
  242. and t.payer_obj_id= #{payerObjId}
  243. </if>
  244. </select>
  245. <!-- 查询欠费统计信息 add by wuxw 2018-07-03 -->
  246. <select id="queryReportAllOweFees" parameterType="Map" resultType="Map">
  247. select t.config_name,t.config_name configName,t.deadline_time,t.deadline_time
  248. deadlineTime,t.owner_tel,t.owner_tel ownerTel,t.update_time,t.update_time updateTime,t.owe_id,t.owe_id
  249. oweId,t.fee_id,t.fee_id feeId,t.amount_owed,t.amount_owed amountOwed,t.payer_obj_name,t.payer_obj_name
  250. payerObjName,t.config_id,t.config_id configId,t.fee_name,t.fee_name
  251. feeName,t.end_time,t.end_time endTime,t.community_id,t.community_id
  252. communityId,t.payer_obj_type,t.payer_obj_type payerObjType,t.payer_obj_id,t.payer_obj_id payerObjId,
  253. t.owner_id,t.owner_id ownerId,t.owner_name,t.owner_name ownerName
  254. from report_owe_fee t
  255. LEFT JOIN pay_fee pf on t.fee_id = pf.fee_id
  256. LEFT JOIN building_room br on pf.payer_obj_id = br.room_id and br.status_cd = '0'
  257. LEFT JOIN building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0'
  258. where 1 =1
  259. and pf.status_cd = '0'
  260. <if test="roomSubType !=null and roomSubType != ''">
  261. and br.room_sub_type = #{roomSubType}
  262. </if>
  263. <if test="roomNum !=null and roomNum != ''">
  264. and br.room_num = #{roomNum}
  265. </if>
  266. <if test="floorId !=null and floorId != ''">
  267. and bu.floor_id = #{floorId}
  268. </if>
  269. <if test="unitId !=null and unitId != ''">
  270. and bu.unit_id = #{unitId}
  271. </if>
  272. <if test="configName !=null and configName != ''">
  273. and t.config_name= #{configName}
  274. </if>
  275. <if test="deadlineTime !=null and deadlineTime != ''">
  276. and t.deadline_time= #{deadlineTime}
  277. </if>
  278. <if test="ownerTel !=null and ownerTel != ''">
  279. and t.owner_tel= #{ownerTel}
  280. </if>
  281. <if test="updateTime !=null and updateTime != ''">
  282. and t.update_time= #{updateTime}
  283. </if>
  284. <if test="oweId !=null and oweId != ''">
  285. and t.owe_id= #{oweId}
  286. </if>
  287. <if test="ownerId !=null and ownerId != ''">
  288. and t.owner_id= #{ownerId}
  289. </if>
  290. <if test="feeId !=null and feeId != ''">
  291. and t.fee_id= #{feeId}
  292. </if>
  293. <if test="amountOwed !=null and amountOwed != ''">
  294. and t.amount_owed= #{amountOwed}
  295. </if>
  296. <if test="payerObjName !=null and payerObjName != ''">
  297. and t.payer_obj_name= #{payerObjName}
  298. </if>
  299. <if test="ownerName !=null and ownerName != ''">
  300. and t.owner_name= #{ownerName}
  301. </if>
  302. <if test="configId !=null and configId != ''">
  303. and t.config_id= #{configId}
  304. </if>
  305. <if test='hasOweFee !=null and hasOweFee == "Y"'>
  306. and t.amount_owed &gt; 0
  307. </if>
  308. <if test="configIds !=null">
  309. and t.config_id in
  310. <foreach collection="configIds" item="item" index="index" open="(" close=")" separator=",">
  311. #{item}
  312. </foreach>
  313. </if>
  314. <if test="feeName !=null and feeName != ''">
  315. and t.fee_name= #{feeName}
  316. </if>
  317. <if test="endTime !=null and endTime != ''">
  318. and t.end_time= #{endTime}
  319. </if>
  320. <if test="communityId !=null and communityId != ''">
  321. and t.community_id= #{communityId}
  322. </if>
  323. <if test="payerObjType !=null and payerObjType != ''">
  324. and t.payer_obj_type= #{payerObjType}
  325. </if>
  326. <if test="payerObjId !=null and payerObjId != ''">
  327. and t.payer_obj_id= #{payerObjId}
  328. </if>
  329. <if test="payerObjIds !=null">
  330. and t.payer_obj_id in
  331. <foreach collection="payerObjIds" item="item" index="index" open="(" close=")" separator=",">
  332. #{item}
  333. </foreach>
  334. </if>
  335. order by t.payer_obj_name
  336. <if test="page != -1 and page != null ">
  337. limit #{page}, #{row}
  338. </if>
  339. </select>
  340. <!-- 查询欠费统计信息 add by wuxw 2018-07-03 t.owner_tel,t.owner_tel ownerTel,-->
  341. <select id="queryReportAllOweFeesByRoom" parameterType="Map" resultType="Map">
  342. select t.config_name,t.config_name configName,t.deadline_time,t.deadline_time
  343. deadlineTime,t.update_time,t.update_time updateTime,t.owe_id,t.owe_id
  344. oweId,t.fee_id,t.fee_id feeId,t.amount_owed,t.amount_owed amountOwed,t.payer_obj_name,t.payer_obj_name
  345. payerObjName,t.config_id,t.config_id configId,t.fee_name,t.fee_name
  346. feeName,t.end_time,t.end_time endTime,t.community_id,t.community_id
  347. communityId,t.payer_obj_type,t.payer_obj_type payerObjType,t.payer_obj_id,t.payer_obj_id payerObjId,
  348. bo.owner_id ownerId,bo.name ownerName,bo.link ownerTel
  349. from report_owe_fee t
  350. left join building_owner_room_rel borr on borr.room_id = t.payer_obj_id and borr.status_cd = '0'
  351. left join building_owner bo on borr.owner_id = bo.owner_id and bo.owner_type_cd = '1001' and bo.status_cd = '0'
  352. LEFT JOIN pay_fee pf on t.fee_id = pf.fee_id
  353. where 1 =1
  354. and pf.status_cd = '0'
  355. <if test="configName !=null and configName != ''">
  356. and t.config_name= #{configName}
  357. </if>
  358. <if test="deadlineTime !=null and deadlineTime != ''">
  359. and t.deadline_time= #{deadlineTime}
  360. </if>
  361. <if test="ownerTel !=null and ownerTel != ''">
  362. and t.owner_tel= #{ownerTel}
  363. </if>
  364. <if test="updateTime !=null and updateTime != ''">
  365. and t.update_time= #{updateTime}
  366. </if>
  367. <if test="oweId !=null and oweId != ''">
  368. and t.owe_id= #{oweId}
  369. </if>
  370. <if test="ownerId !=null and ownerId != ''">
  371. and bo.owner_id= #{ownerId}
  372. </if>
  373. <if test="feeId !=null and feeId != ''">
  374. and t.fee_id= #{feeId}
  375. </if>
  376. <if test="amountOwed !=null and amountOwed != ''">
  377. and t.amount_owed= #{amountOwed}
  378. </if>
  379. <if test="payerObjName !=null and payerObjName != ''">
  380. and t.payer_obj_name= #{payerObjName}
  381. </if>
  382. <if test="ownerName !=null and ownerName != ''">
  383. and bo.name= #{ownerName}
  384. </if>
  385. <if test="configId !=null and configId != ''">
  386. and t.config_id= #{configId}
  387. </if>
  388. <if test='hasOweFee !=null and hasOweFee == "Y"'>
  389. and t.amount_owed &gt; 0
  390. </if>
  391. <if test="configIds !=null">
  392. and t.config_id in
  393. <foreach collection="configIds" item="item" index="index" open="(" close=")" separator=",">
  394. #{item}
  395. </foreach>
  396. </if>
  397. <if test="feeName !=null and feeName != ''">
  398. and t.fee_name= #{feeName}
  399. </if>
  400. <if test="endTime !=null and endTime != ''">
  401. and t.end_time= #{endTime}
  402. </if>
  403. <if test="communityId !=null and communityId != ''">
  404. and t.community_id= #{communityId}
  405. </if>
  406. <if test="payerObjType !=null and payerObjType != ''">
  407. and t.payer_obj_type= #{payerObjType}
  408. </if>
  409. <if test="payerObjId !=null and payerObjId != ''">
  410. and t.payer_obj_id= #{payerObjId}
  411. </if>
  412. <if test="payerObjIds !=null">
  413. and t.payer_obj_id in
  414. <foreach collection="payerObjIds" item="item" index="index" open="(" close=")" separator=",">
  415. #{item}
  416. </foreach>
  417. </if>
  418. order by t.create_time desc
  419. <if test="page != -1 and page != null ">
  420. limit #{page}, #{row}
  421. </if>
  422. </select>
  423. <!-- 查询欠费统计信息 add by wuxw 2018-07-03 -->
  424. <select id="queryReportAllOweFeesByCar" parameterType="Map" resultType="Map">
  425. select t.config_name,t.config_name configName,t.deadline_time,t.deadline_time
  426. deadlineTime,t.owner_tel,t.owner_tel ownerTel,t.update_time,t.update_time updateTime,t.owe_id,t.owe_id
  427. oweId,t.fee_id,t.fee_id feeId,t.amount_owed,t.amount_owed amountOwed,t.payer_obj_name,t.payer_obj_name
  428. payerObjName,t.config_id,t.config_id configId,t.fee_name,t.fee_name
  429. feeName,t.end_time,t.end_time endTime,t.community_id,t.community_id
  430. communityId,t.payer_obj_type,t.payer_obj_type payerObjType,t.payer_obj_id,t.payer_obj_id payerObjId,
  431. bo.owner_id ownerId,bo.name ownerName,bo.link ownerTel
  432. from report_owe_fee t
  433. left join owner_car oc on oc.car_id = t.payer_obj_id and oc.status_cd = '0'
  434. left join building_owner bo on oc.owner_id = bo.owner_id and bo.owner_type_cd = '1001' and bo.status_cd = '0'
  435. LEFT JOIN pay_fee pf on t.fee_id = pf.fee_id
  436. where 1 =1
  437. and pf.status_cd = '0'
  438. <if test="configName !=null and configName != ''">
  439. and t.config_name= #{configName}
  440. </if>
  441. <if test="deadlineTime !=null and deadlineTime != ''">
  442. and t.deadline_time= #{deadlineTime}
  443. </if>
  444. <if test="ownerTel !=null and ownerTel != ''">
  445. and t.owner_tel= #{ownerTel}
  446. </if>
  447. <if test="updateTime !=null and updateTime != ''">
  448. and t.update_time= #{updateTime}
  449. </if>
  450. <if test="oweId !=null and oweId != ''">
  451. and t.owe_id= #{oweId}
  452. </if>
  453. <if test="ownerId !=null and ownerId != ''">
  454. and bo.owner_id= #{ownerId}
  455. </if>
  456. <if test="feeId !=null and feeId != ''">
  457. and t.fee_id= #{feeId}
  458. </if>
  459. <if test="amountOwed !=null and amountOwed != ''">
  460. and t.amount_owed= #{amountOwed}
  461. </if>
  462. <if test="payerObjName !=null and payerObjName != ''">
  463. and t.payer_obj_name= #{payerObjName}
  464. </if>
  465. <if test="ownerName !=null and ownerName != ''">
  466. and bo.name= #{ownerName}
  467. </if>
  468. <if test="configId !=null and configId != ''">
  469. and t.config_id= #{configId}
  470. </if>
  471. <if test='hasOweFee !=null and hasOweFee == "Y"'>
  472. and t.amount_owed &gt; 0
  473. </if>
  474. <if test="configIds !=null">
  475. and t.config_id in
  476. <foreach collection="configIds" item="item" index="index" open="(" close=")" separator=",">
  477. #{item}
  478. </foreach>
  479. </if>
  480. <if test="feeName !=null and feeName != ''">
  481. and t.fee_name= #{feeName}
  482. </if>
  483. <if test="endTime !=null and endTime != ''">
  484. and t.end_time= #{endTime}
  485. </if>
  486. <if test="communityId !=null and communityId != ''">
  487. and t.community_id= #{communityId}
  488. </if>
  489. <if test="payerObjType !=null and payerObjType != ''">
  490. and t.payer_obj_type= #{payerObjType}
  491. </if>
  492. <if test="payerObjId !=null and payerObjId != ''">
  493. and t.payer_obj_id= #{payerObjId}
  494. </if>
  495. <if test="payerObjIds !=null">
  496. and t.payer_obj_id in
  497. <foreach collection="payerObjIds" item="item" index="index" open="(" close=")" separator=",">
  498. #{item}
  499. </foreach>
  500. </if>
  501. order by t.create_time desc
  502. <if test="page != -1 and page != null ">
  503. limit #{page}, #{row}
  504. </if>
  505. </select>
  506. <select id="queryReportAllOweFeesByContract" parameterType="Map" resultType="Map">
  507. select t.config_name,t.config_name configName,t.deadline_time,t.deadline_time
  508. deadlineTime,t.owner_tel,t.owner_tel ownerTel,t.update_time,t.update_time updateTime,t.owe_id,t.owe_id
  509. oweId,t.fee_id,t.fee_id feeId,t.amount_owed,t.amount_owed amountOwed,t.payer_obj_name,t.payer_obj_name
  510. payerObjName,t.config_id,t.config_id configId,t.fee_name,t.fee_name
  511. feeName,t.end_time,t.end_time endTime,t.community_id,t.community_id
  512. communityId,t.payer_obj_type,t.payer_obj_type payerObjType,t.payer_obj_id,t.payer_obj_id payerObjId,
  513. ct.obj_id ownerId,ct.party_b ownerName,ct.a_link ownerTel
  514. from report_owe_fee t
  515. left join contract ct on ct.contract_id = t.payer_obj_id and ct.status_cd = '0'
  516. LEFT JOIN pay_fee pf on t.fee_id = pf.fee_id
  517. where 1 =1
  518. and pf.status_cd = '0'
  519. <if test="configName !=null and configName != ''">
  520. and t.config_name= #{configName}
  521. </if>
  522. <if test="deadlineTime !=null and deadlineTime != ''">
  523. and t.deadline_time= #{deadlineTime}
  524. </if>
  525. <if test="ownerTel !=null and ownerTel != ''">
  526. and t.owner_tel= #{ownerTel}
  527. </if>
  528. <if test="updateTime !=null and updateTime != ''">
  529. and t.update_time= #{updateTime}
  530. </if>
  531. <if test="oweId !=null and oweId != ''">
  532. and t.owe_id= #{oweId}
  533. </if>
  534. <if test="ownerId !=null and ownerId != ''">
  535. and ct.obj_id= #{ownerId}
  536. </if>
  537. <if test="feeId !=null and feeId != ''">
  538. and t.fee_id= #{feeId}
  539. </if>
  540. <if test="amountOwed !=null and amountOwed != ''">
  541. and t.amount_owed= #{amountOwed}
  542. </if>
  543. <if test="payerObjName !=null and payerObjName != ''">
  544. and t.payer_obj_name= #{payerObjName}
  545. </if>
  546. <if test="ownerName !=null and ownerName != ''">
  547. and ct.party_b= #{ownerName}
  548. </if>
  549. <if test="configId !=null and configId != ''">
  550. and t.config_id= #{configId}
  551. </if>
  552. <if test='hasOweFee !=null and hasOweFee == "Y"'>
  553. and t.amount_owed &gt; 0
  554. </if>
  555. <if test="configIds !=null">
  556. and t.config_id in
  557. <foreach collection="configIds" item="item" index="index" open="(" close=")" separator=",">
  558. #{item}
  559. </foreach>
  560. </if>
  561. <if test="feeName !=null and feeName != ''">
  562. and t.fee_name= #{feeName}
  563. </if>
  564. <if test="endTime !=null and endTime != ''">
  565. and t.end_time= #{endTime}
  566. </if>
  567. <if test="communityId !=null and communityId != ''">
  568. and t.community_id= #{communityId}
  569. </if>
  570. <if test="payerObjType !=null and payerObjType != ''">
  571. and t.payer_obj_type= #{payerObjType}
  572. </if>
  573. <if test="payerObjId !=null and payerObjId != ''">
  574. and t.payer_obj_id= #{payerObjId}
  575. </if>
  576. <if test="payerObjIds !=null">
  577. and t.payer_obj_id in
  578. <foreach collection="payerObjIds" item="item" index="index" open="(" close=")" separator=",">
  579. #{item}
  580. </foreach>
  581. </if>
  582. order by t.create_time desc
  583. <if test="page != -1 and page != null ">
  584. limit #{page}, #{row}
  585. </if>
  586. </select>
  587. <select id="computeReportOweFeeTotalAmount" parameterType="Map" resultType="Map">
  588. select sum(t.amount_owed) total
  589. from report_owe_fee t
  590. LEFT JOIN pay_fee pf on t.fee_id = pf.fee_id
  591. LEFT JOIN building_room br on pf.payer_obj_id = br.room_id and br.status_cd = '0'
  592. LEFT JOIN building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0'
  593. where 1 =1
  594. and pf.status_cd = '0'
  595. <if test="roomSubType !=null and roomSubType != ''">
  596. and br.room_sub_type = #{roomSubType}
  597. </if>
  598. <if test="roomNum !=null and roomNum != ''">
  599. and br.room_num = #{roomNum}
  600. </if>
  601. <if test="floorId !=null and floorId != ''">
  602. and bu.floor_id = #{floorId}
  603. </if>
  604. <if test="unitId !=null and unitId != ''">
  605. and bu.unit_id = #{unitId}
  606. </if>
  607. <if test="configName !=null and configName != ''">
  608. and t.config_name= #{configName}
  609. </if>
  610. <if test="deadlineTime !=null and deadlineTime != ''">
  611. and t.deadline_time= #{deadlineTime}
  612. </if>
  613. <if test="ownerTel !=null and ownerTel != ''">
  614. and t.owner_tel= #{ownerTel}
  615. </if>
  616. <if test="updateTime !=null and updateTime != ''">
  617. and t.update_time= #{updateTime}
  618. </if>
  619. <if test="oweId !=null and oweId != ''">
  620. and t.owe_id= #{oweId}
  621. </if>
  622. <if test="ownerId !=null and ownerId != ''">
  623. and t.owner_id= #{ownerId}
  624. </if>
  625. <if test="feeId !=null and feeId != ''">
  626. and t.fee_id= #{feeId}
  627. </if>
  628. <if test="amountOwed !=null and amountOwed != ''">
  629. and t.amount_owed= #{amountOwed}
  630. </if>
  631. <if test='hasOweFee !=null and hasOweFee == "Y"'>
  632. and t.amount_owed &gt; 0
  633. </if>
  634. <if test="payerObjName !=null and payerObjName != ''">
  635. and t.payer_obj_name= #{payerObjName}
  636. </if>
  637. <if test="ownerName !=null and ownerName != ''">
  638. and t.owner_name= #{ownerName}
  639. </if>
  640. <if test="configId !=null and configId != ''">
  641. and t.config_id= #{configId}
  642. </if>
  643. <if test="configIds !=null">
  644. and t.config_id in
  645. <foreach collection="configIds" item="item" index="index" open="(" close=")" separator=",">
  646. #{item}
  647. </foreach>
  648. </if>
  649. <if test="feeName !=null and feeName != ''">
  650. and t.fee_name= #{feeName}
  651. </if>
  652. <if test="endTime !=null and endTime != ''">
  653. and t.end_time= #{endTime}
  654. </if>
  655. <if test="communityId !=null and communityId != ''">
  656. and t.community_id= #{communityId}
  657. </if>
  658. <if test="payerObjType !=null and payerObjType != ''">
  659. and t.payer_obj_type= #{payerObjType}
  660. </if>
  661. <if test="payerObjId !=null and payerObjId != ''">
  662. and t.payer_obj_id= #{payerObjId}
  663. </if>
  664. </select>
  665. <select id="computeReportOweFeeItemAmount" parameterType="Map" resultType="Map">
  666. select t.config_name configName,sum(t.amount_owed) totalOweAmount
  667. from report_owe_fee t
  668. LEFT JOIN pay_fee pf on t.fee_id = pf.fee_id
  669. LEFT JOIN building_room br on pf.payer_obj_id = br.room_id and br.status_cd = '0'
  670. LEFT JOIN building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0'
  671. where 1 =1
  672. and pf.status_cd = '0'
  673. <if test="roomSubType !=null and roomSubType != ''">
  674. and br.room_sub_type = #{roomSubType}
  675. </if>
  676. <if test="roomNum !=null and roomNum != ''">
  677. and br.room_num = #{roomNum}
  678. </if>
  679. <if test="floorId !=null and floorId != ''">
  680. and bu.floor_id = #{floorId}
  681. </if>
  682. <if test="unitId !=null and unitId != ''">
  683. and bu.unit_id = #{unitId}
  684. </if>
  685. <if test="configName !=null and configName != ''">
  686. and t.config_name= #{configName}
  687. </if>
  688. <if test="deadlineTime !=null and deadlineTime != ''">
  689. and t.deadline_time= #{deadlineTime}
  690. </if>
  691. <if test="ownerTel !=null and ownerTel != ''">
  692. and t.owner_tel= #{ownerTel}
  693. </if>
  694. <if test="updateTime !=null and updateTime != ''">
  695. and t.update_time= #{updateTime}
  696. </if>
  697. <if test="oweId !=null and oweId != ''">
  698. and t.owe_id= #{oweId}
  699. </if>
  700. <if test="ownerId !=null and ownerId != ''">
  701. and t.owner_id= #{ownerId}
  702. </if>
  703. <if test="feeId !=null and feeId != ''">
  704. and t.fee_id= #{feeId}
  705. </if>
  706. <if test="amountOwed !=null and amountOwed != ''">
  707. and t.amount_owed= #{amountOwed}
  708. </if>
  709. <if test='hasOweFee !=null and hasOweFee == "Y"'>
  710. and t.amount_owed &gt; 0
  711. </if>
  712. <if test="payerObjName !=null and payerObjName != ''">
  713. and t.payer_obj_name= #{payerObjName}
  714. </if>
  715. <if test="ownerName !=null and ownerName != ''">
  716. and t.owner_name= #{ownerName}
  717. </if>
  718. <if test="configId !=null and configId != ''">
  719. and t.config_id= #{configId}
  720. </if>
  721. <if test="configIds !=null">
  722. and t.config_id in
  723. <foreach collection="configIds" item="item" index="index" open="(" close=")" separator=",">
  724. #{item}
  725. </foreach>
  726. </if>
  727. <if test="feeName !=null and feeName != ''">
  728. and t.fee_name= #{feeName}
  729. </if>
  730. <if test="endTime !=null and endTime != ''">
  731. and t.end_time= #{endTime}
  732. </if>
  733. <if test="communityId !=null and communityId != ''">
  734. and t.community_id= #{communityId}
  735. </if>
  736. <if test="payerObjType !=null and payerObjType != ''">
  737. and t.payer_obj_type= #{payerObjType}
  738. </if>
  739. <if test="payerObjId !=null and payerObjId != ''">
  740. and t.payer_obj_id= #{payerObjId}
  741. </if>
  742. GROUP BY t.config_id,t.config_name
  743. </select>
  744. <!-- 查询无效费用 add by wuxw 2018-07-03 -->
  745. <select id="queryInvalidOweFee" parameterType="Map" resultType="Map">
  746. select t.fee_id feeId from pay_fee t
  747. inner join pay_fee_config pfc on t.config_id = pfc.config_id
  748. inner join report_owe_fee rof on t.fee_id = rof.fee_id
  749. where (t.status_cd = '1' or pfc.status_cd = '1')
  750. and t.community_id= #{communityId}
  751. </select>
  752. <update id="deleteInvalidFee" parameterType="Map">
  753. delete from report_owe_fee where fee_id in
  754. <foreach collection="feeIds" item="item" open="(" close=")" separator=",">
  755. #{item}
  756. </foreach>
  757. and community_id = #{communityId}
  758. </update>
  759. <select id="queryOweFeesByOwnerIds" parameterType="Map" resultType="Map">
  760. select t.owner_id ownerId,SUM(t.amount_owed) oweFee
  761. from report_owe_fee t
  762. where t.community_id = #{communityId}
  763. and t.owner_id in
  764. <foreach collection="ownerIds" item="item" open="(" close=")" separator=",">
  765. #{item}
  766. </foreach>
  767. group by t.owner_id
  768. </select>
  769. <select id="queryOweFeesByRoomIds" parameterType="Map" resultType="Map">
  770. select t.payer_obj_id roomId,SUM(t.amount_owed) oweFee
  771. from report_owe_fee t
  772. where t.community_id = #{communityId}
  773. and t.payer_obj_type = '3333'
  774. and t.payer_obj_id in
  775. <foreach collection="roomIds" item="item" open="(" close=")" separator=",">
  776. #{item}
  777. </foreach>
  778. group by t.payer_obj_id
  779. </select>
  780. </mapper>