ReportOweFeeServiceDaoImplMapper.xml 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469
  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. where 1 =1
  19. and pf.status_cd = '0'
  20. <if test="configName !=null and configName != ''">
  21. and t.config_name= #{configName}
  22. </if>
  23. <if test="deadlineTime !=null and deadlineTime != ''">
  24. and t.deadline_time= #{deadlineTime}
  25. </if>
  26. <if test="ownerTel !=null and ownerTel != ''">
  27. and t.owner_tel= #{ownerTel}
  28. </if>
  29. <if test="updateTime !=null and updateTime != ''">
  30. and t.update_time= #{updateTime}
  31. </if>
  32. <if test="oweId !=null and oweId != ''">
  33. and t.owe_id= #{oweId}
  34. </if>
  35. <if test="ownerId !=null and ownerId != ''">
  36. and t.owner_id= #{ownerId}
  37. </if>
  38. <if test="feeId !=null and feeId != ''">
  39. and t.fee_id= #{feeId}
  40. </if>
  41. <if test="amountOwed !=null and amountOwed != ''">
  42. and t.amount_owed= #{amountOwed}
  43. </if>
  44. <if test='hasOweFee !=null and hasOweFee == "Y"'>
  45. and t.amount_owed &gt; 0
  46. </if>
  47. <if test="payerObjName !=null and payerObjName != ''">
  48. and t.payer_obj_name= #{payerObjName}
  49. </if>
  50. <if test="ownerName !=null and ownerName != ''">
  51. and t.owner_name= #{ownerName}
  52. </if>
  53. <if test="configId !=null and configId != ''">
  54. and t.config_id= #{configId}
  55. </if>
  56. <if test="configIds !=null">
  57. and t.config_id in
  58. <foreach collection="configIds" item="item" index="index" open="(" close=")" separator=",">
  59. #{item}
  60. </foreach>
  61. </if>
  62. <if test="feeName !=null and feeName != ''">
  63. and t.fee_name= #{feeName}
  64. </if>
  65. <if test="endTime !=null and endTime != ''">
  66. and t.end_time= #{endTime}
  67. </if>
  68. <if test="communityId !=null and communityId != ''">
  69. and t.community_id= #{communityId}
  70. </if>
  71. <if test="payerObjType !=null and payerObjType != ''">
  72. and t.payer_obj_type= #{payerObjType}
  73. </if>
  74. <if test="payerObjId !=null and payerObjId != ''">
  75. and t.payer_obj_id= #{payerObjId}
  76. </if>
  77. order by t.payer_obj_name
  78. <if test="page != -1 and page != null ">
  79. limit #{page}, #{row}
  80. </if>
  81. </select>
  82. <!-- 修改欠费统计信息 add by wuxw 2018-07-03 -->
  83. <update id="updateReportOweFeeInfo" parameterType="Map">
  84. update report_owe_fee t
  85. <set>
  86. <if test="configName !=null and configName != ''">
  87. t.config_name= #{configName},
  88. </if>
  89. <if test="deadlineTime !=null and deadlineTime != ''">
  90. t.deadline_time= #{deadlineTime},
  91. </if>
  92. <if test="ownerTel !=null and ownerTel != ''">
  93. t.owner_tel= #{ownerTel},
  94. </if>
  95. <if test="updateTime !=null and updateTime != ''">
  96. t.update_time= #{updateTime},
  97. </if>
  98. <if test="ownerId !=null and ownerId != ''">
  99. t.owner_id= #{ownerId},
  100. </if>
  101. <if test="feeId !=null and feeId != ''">
  102. t.fee_id= #{feeId},
  103. </if>
  104. <if test="amountOwed !=null and amountOwed != ''">
  105. t.amount_owed= #{amountOwed},
  106. </if>
  107. <if test="payerObjName !=null and payerObjName != ''">
  108. t.payer_obj_name= #{payerObjName},
  109. </if>
  110. <if test="ownerName !=null and ownerName != ''">
  111. t.owner_name= #{ownerName},
  112. </if>
  113. <if test="configId !=null and configId != ''">
  114. t.config_id= #{configId},
  115. </if>
  116. <if test="feeName !=null and feeName != ''">
  117. t.fee_name= #{feeName},
  118. </if>
  119. <if test="endTime !=null and endTime != ''">
  120. t.end_time= #{endTime},
  121. </if>
  122. <if test="communityId !=null and communityId != ''">
  123. t.community_id= #{communityId},
  124. </if>
  125. <if test="payerObjType !=null and payerObjType != ''">
  126. t.payer_obj_type= #{payerObjType},
  127. </if>
  128. <if test="payerObjId !=null and payerObjId != ''">
  129. t.payer_obj_id= #{payerObjId}
  130. </if>
  131. </set>
  132. where 1=1
  133. and t.owe_id= #{oweId}
  134. <if test="communityId !=null and communityId != ''">
  135. and t.community_id= #{communityId}
  136. </if>
  137. </update>
  138. <!-- 修改欠费统计信息 add by wuxw 2018-07-03 -->
  139. <update id="deleteReportOweFeeInfo" parameterType="Map">
  140. delete from report_owe_fee
  141. where 1=1
  142. <if test="oweId !=null and oweId != ''">
  143. and owe_id= #{oweId}
  144. </if>
  145. <if test="feeId !=null and feeId != ''">
  146. and fee_id = #{feeId}
  147. </if>
  148. <if test="communityId !=null and communityId != ''">
  149. and community_id= #{communityId}
  150. </if>
  151. </update>
  152. <!-- 查询欠费统计数量 add by wuxw 2018-07-03 -->
  153. <select id="queryReportOweFeesCount" parameterType="Map" resultType="Map">
  154. select count(distinct(t.payer_obj_id)) count
  155. from report_owe_fee t
  156. LEFT JOIN pay_fee pf on t.fee_id = pf.fee_id
  157. where 1 =1
  158. and pf.status_cd = '0'
  159. <if test="configName !=null and configName != ''">
  160. and t.config_name= #{configName}
  161. </if>
  162. <if test="deadlineTime !=null and deadlineTime != ''">
  163. and t.deadline_time= #{deadlineTime}
  164. </if>
  165. <if test="ownerTel !=null and ownerTel != ''">
  166. and t.owner_tel= #{ownerTel}
  167. </if>
  168. <if test="updateTime !=null and updateTime != ''">
  169. and t.update_time= #{updateTime}
  170. </if>
  171. <if test="oweId !=null and oweId != ''">
  172. and t.owe_id= #{oweId}
  173. </if>
  174. <if test="ownerId !=null and ownerId != ''">
  175. and t.owner_id= #{ownerId}
  176. </if>
  177. <if test="feeId !=null and feeId != ''">
  178. and t.fee_id= #{feeId}
  179. </if>
  180. <if test="amountOwed !=null and amountOwed != ''">
  181. and t.amount_owed= #{amountOwed}
  182. </if>
  183. <if test='hasOweFee !=null and hasOweFee == "Y"'>
  184. and t.amount_owed &gt; 0
  185. </if>
  186. <if test="payerObjName !=null and payerObjName != ''">
  187. and t.payer_obj_name= #{payerObjName}
  188. </if>
  189. <if test="ownerName !=null and ownerName != ''">
  190. and t.owner_name= #{ownerName}
  191. </if>
  192. <if test="configId !=null and configId != ''">
  193. and t.config_id= #{configId}
  194. </if>
  195. <if test="configIds !=null">
  196. and t.config_id in
  197. <foreach collection="configIds" item="item" index="index" open="(" close=")" separator=",">
  198. #{item}
  199. </foreach>
  200. </if>
  201. <if test="feeName !=null and feeName != ''">
  202. and t.fee_name= #{feeName}
  203. </if>
  204. <if test="endTime !=null and endTime != ''">
  205. and t.end_time= #{endTime}
  206. </if>
  207. <if test="communityId !=null and communityId != ''">
  208. and t.community_id= #{communityId}
  209. </if>
  210. <if test="payerObjType !=null and payerObjType != ''">
  211. and t.payer_obj_type= #{payerObjType}
  212. </if>
  213. <if test="payerObjId !=null and payerObjId != ''">
  214. and t.payer_obj_id= #{payerObjId}
  215. </if>
  216. </select>
  217. <!-- 查询欠费统计信息 add by wuxw 2018-07-03 -->
  218. <select id="queryReportAllOweFees" parameterType="Map" resultType="Map">
  219. select t.config_name,t.config_name configName,t.deadline_time,t.deadline_time
  220. deadlineTime,t.owner_tel,t.owner_tel ownerTel,t.update_time,t.update_time updateTime,t.owe_id,t.owe_id
  221. oweId,t.fee_id,t.fee_id feeId,t.amount_owed,t.amount_owed amountOwed,t.payer_obj_name,t.payer_obj_name
  222. payerObjName,t.config_id,t.config_id configId,t.fee_name,t.fee_name
  223. feeName,t.end_time,t.end_time endTime,t.community_id,t.community_id
  224. communityId,t.payer_obj_type,t.payer_obj_type payerObjType,t.payer_obj_id,t.payer_obj_id payerObjId,
  225. t.owner_id,t.owner_id ownerId,t.owner_name,t.owner_name ownerName
  226. from report_owe_fee t
  227. LEFT JOIN pay_fee pf on t.fee_id = pf.fee_id
  228. where 1 =1
  229. and pf.status_cd = '0'
  230. <if test="configName !=null and configName != ''">
  231. and t.config_name= #{configName}
  232. </if>
  233. <if test="deadlineTime !=null and deadlineTime != ''">
  234. and t.deadline_time= #{deadlineTime}
  235. </if>
  236. <if test="ownerTel !=null and ownerTel != ''">
  237. and t.owner_tel= #{ownerTel}
  238. </if>
  239. <if test="updateTime !=null and updateTime != ''">
  240. and t.update_time= #{updateTime}
  241. </if>
  242. <if test="oweId !=null and oweId != ''">
  243. and t.owe_id= #{oweId}
  244. </if>
  245. <if test="ownerId !=null and ownerId != ''">
  246. and t.owner_id= #{ownerId}
  247. </if>
  248. <if test="feeId !=null and feeId != ''">
  249. and t.fee_id= #{feeId}
  250. </if>
  251. <if test="amountOwed !=null and amountOwed != ''">
  252. and t.amount_owed= #{amountOwed}
  253. </if>
  254. <if test="payerObjName !=null and payerObjName != ''">
  255. and t.payer_obj_name= #{payerObjName}
  256. </if>
  257. <if test="ownerName !=null and ownerName != ''">
  258. and t.owner_name= #{ownerName}
  259. </if>
  260. <if test="configId !=null and configId != ''">
  261. and t.config_id= #{configId}
  262. </if>
  263. <if test="configIds !=null">
  264. and t.config_id in
  265. <foreach collection="configIds" item="item" index="index" open="(" close=")" separator=",">
  266. #{item}
  267. </foreach>
  268. </if>
  269. <if test="feeName !=null and feeName != ''">
  270. and t.fee_name= #{feeName}
  271. </if>
  272. <if test="endTime !=null and endTime != ''">
  273. and t.end_time= #{endTime}
  274. </if>
  275. <if test="communityId !=null and communityId != ''">
  276. and t.community_id= #{communityId}
  277. </if>
  278. <if test="payerObjType !=null and payerObjType != ''">
  279. and t.payer_obj_type= #{payerObjType}
  280. </if>
  281. <if test="payerObjId !=null and payerObjId != ''">
  282. and t.payer_obj_id= #{payerObjId}
  283. </if>
  284. <if test="payerObjIds !=null">
  285. and t.payer_obj_id in
  286. <foreach collection="payerObjIds" item="item" index="index" open="(" close=")" separator=",">
  287. #{item}
  288. </foreach>
  289. </if>
  290. order by t.payer_obj_name
  291. <if test="page != -1 and page != null ">
  292. limit #{page}, #{row}
  293. </if>
  294. </select>
  295. <!-- 查询欠费统计信息 add by wuxw 2018-07-03 -->
  296. <select id="queryReportAllOweFeesByRoom" parameterType="Map" resultType="Map">
  297. select t.config_name,t.config_name configName,t.deadline_time,t.deadline_time
  298. deadlineTime,t.owner_tel,t.owner_tel ownerTel,t.update_time,t.update_time updateTime,t.owe_id,t.owe_id
  299. oweId,t.fee_id,t.fee_id feeId,t.amount_owed,t.amount_owed amountOwed,t.payer_obj_name,t.payer_obj_name
  300. payerObjName,t.config_id,t.config_id configId,t.fee_name,t.fee_name
  301. feeName,t.end_time,t.end_time endTime,t.community_id,t.community_id
  302. communityId,t.payer_obj_type,t.payer_obj_type payerObjType,t.payer_obj_id,t.payer_obj_id payerObjId,
  303. bo.owner_id ownerId,bo.name ownerName
  304. from report_owe_fee t
  305. left join building_owner_room_rel borr on borr.room_id = t.payer_obj_id and borr.status_cd = '0'
  306. left join building_owner bo on borr.owner_id = bo.owner_id and bo.owner_type_cd = '1001' and bo.status_cd = '0'
  307. LEFT JOIN pay_fee pf on t.fee_id = pf.fee_id
  308. where 1 =1
  309. and pf.status_cd = '0'
  310. <if test="configName !=null and configName != ''">
  311. and t.config_name= #{configName}
  312. </if>
  313. <if test="deadlineTime !=null and deadlineTime != ''">
  314. and t.deadline_time= #{deadlineTime}
  315. </if>
  316. <if test="ownerTel !=null and ownerTel != ''">
  317. and t.owner_tel= #{ownerTel}
  318. </if>
  319. <if test="updateTime !=null and updateTime != ''">
  320. and t.update_time= #{updateTime}
  321. </if>
  322. <if test="oweId !=null and oweId != ''">
  323. and t.owe_id= #{oweId}
  324. </if>
  325. <if test="ownerId !=null and ownerId != ''">
  326. and bo.owner_id= #{ownerId}
  327. </if>
  328. <if test="feeId !=null and feeId != ''">
  329. and t.fee_id= #{feeId}
  330. </if>
  331. <if test="amountOwed !=null and amountOwed != ''">
  332. and t.amount_owed= #{amountOwed}
  333. </if>
  334. <if test="payerObjName !=null and payerObjName != ''">
  335. and t.payer_obj_name= #{payerObjName}
  336. </if>
  337. <if test="ownerName !=null and ownerName != ''">
  338. and bo.name= #{ownerName}
  339. </if>
  340. <if test="configId !=null and configId != ''">
  341. and t.config_id= #{configId}
  342. </if>
  343. <if test="configIds !=null">
  344. and t.config_id in
  345. <foreach collection="configIds" item="item" index="index" open="(" close=")" separator=",">
  346. #{item}
  347. </foreach>
  348. </if>
  349. <if test="feeName !=null and feeName != ''">
  350. and t.fee_name= #{feeName}
  351. </if>
  352. <if test="endTime !=null and endTime != ''">
  353. and t.end_time= #{endTime}
  354. </if>
  355. <if test="communityId !=null and communityId != ''">
  356. and t.community_id= #{communityId}
  357. </if>
  358. <if test="payerObjType !=null and payerObjType != ''">
  359. and t.payer_obj_type= #{payerObjType}
  360. </if>
  361. <if test="payerObjId !=null and payerObjId != ''">
  362. and t.payer_obj_id= #{payerObjId}
  363. </if>
  364. <if test="payerObjIds !=null">
  365. and t.payer_obj_id in
  366. <foreach collection="payerObjIds" item="item" index="index" open="(" close=")" separator=",">
  367. #{item}
  368. </foreach>
  369. </if>
  370. order by t.create_time desc
  371. <if test="page != -1 and page != null ">
  372. limit #{page}, #{row}
  373. </if>
  374. </select>
  375. <!-- 查询欠费统计信息 add by wuxw 2018-07-03 -->
  376. <select id="queryReportAllOweFeesByCar" parameterType="Map" resultType="Map">
  377. select t.config_name,t.config_name configName,t.deadline_time,t.deadline_time
  378. deadlineTime,t.owner_tel,t.owner_tel ownerTel,t.update_time,t.update_time updateTime,t.owe_id,t.owe_id
  379. oweId,t.fee_id,t.fee_id feeId,t.amount_owed,t.amount_owed amountOwed,t.payer_obj_name,t.payer_obj_name
  380. payerObjName,t.config_id,t.config_id configId,t.fee_name,t.fee_name
  381. feeName,t.end_time,t.end_time endTime,t.community_id,t.community_id
  382. communityId,t.payer_obj_type,t.payer_obj_type payerObjType,t.payer_obj_id,t.payer_obj_id payerObjId,
  383. bo.owner_id ownerId,bo.name ownerName
  384. from report_owe_fee t
  385. left join owner_car oc on oc.car_id = t.payer_obj_id and oc.status_cd = '0'
  386. left join building_owner bo on oc.owner_id = bo.owner_id and bo.owner_type_cd = '1001' and bo.status_cd = '0'
  387. LEFT JOIN pay_fee pf on t.fee_id = pf.fee_id
  388. where 1 =1
  389. and pf.status_cd = '0'
  390. <if test="configName !=null and configName != ''">
  391. and t.config_name= #{configName}
  392. </if>
  393. <if test="deadlineTime !=null and deadlineTime != ''">
  394. and t.deadline_time= #{deadlineTime}
  395. </if>
  396. <if test="ownerTel !=null and ownerTel != ''">
  397. and t.owner_tel= #{ownerTel}
  398. </if>
  399. <if test="updateTime !=null and updateTime != ''">
  400. and t.update_time= #{updateTime}
  401. </if>
  402. <if test="oweId !=null and oweId != ''">
  403. and t.owe_id= #{oweId}
  404. </if>
  405. <if test="ownerId !=null and ownerId != ''">
  406. and bo.owner_id= #{ownerId}
  407. </if>
  408. <if test="feeId !=null and feeId != ''">
  409. and t.fee_id= #{feeId}
  410. </if>
  411. <if test="amountOwed !=null and amountOwed != ''">
  412. and t.amount_owed= #{amountOwed}
  413. </if>
  414. <if test="payerObjName !=null and payerObjName != ''">
  415. and t.payer_obj_name= #{payerObjName}
  416. </if>
  417. <if test="ownerName !=null and ownerName != ''">
  418. and bo.name= #{ownerName}
  419. </if>
  420. <if test="configId !=null and configId != ''">
  421. and t.config_id= #{configId}
  422. </if>
  423. <if test="configIds !=null">
  424. and t.config_id in
  425. <foreach collection="configIds" item="item" index="index" open="(" close=")" separator=",">
  426. #{item}
  427. </foreach>
  428. </if>
  429. <if test="feeName !=null and feeName != ''">
  430. and t.fee_name= #{feeName}
  431. </if>
  432. <if test="endTime !=null and endTime != ''">
  433. and t.end_time= #{endTime}
  434. </if>
  435. <if test="communityId !=null and communityId != ''">
  436. and t.community_id= #{communityId}
  437. </if>
  438. <if test="payerObjType !=null and payerObjType != ''">
  439. and t.payer_obj_type= #{payerObjType}
  440. </if>
  441. <if test="payerObjId !=null and payerObjId != ''">
  442. and t.payer_obj_id= #{payerObjId}
  443. </if>
  444. <if test="payerObjIds !=null">
  445. and t.payer_obj_id in
  446. <foreach collection="payerObjIds" item="item" index="index" open="(" close=")" separator=",">
  447. #{item}
  448. </foreach>
  449. </if>
  450. order by t.create_time desc
  451. <if test="page != -1 and page != null ">
  452. limit #{page}, #{row}
  453. </if>
  454. </select>
  455. </mapper>