ReportOweFeeServiceDaoImplMapper.xml 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506
  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_name
  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. <update 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. </update>
  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. where 1 =1
  257. and pf.status_cd = '0'
  258. <if test="configName !=null and configName != ''">
  259. and t.config_name= #{configName}
  260. </if>
  261. <if test="deadlineTime !=null and deadlineTime != ''">
  262. and t.deadline_time= #{deadlineTime}
  263. </if>
  264. <if test="ownerTel !=null and ownerTel != ''">
  265. and t.owner_tel= #{ownerTel}
  266. </if>
  267. <if test="updateTime !=null and updateTime != ''">
  268. and t.update_time= #{updateTime}
  269. </if>
  270. <if test="oweId !=null and oweId != ''">
  271. and t.owe_id= #{oweId}
  272. </if>
  273. <if test="ownerId !=null and ownerId != ''">
  274. and t.owner_id= #{ownerId}
  275. </if>
  276. <if test="feeId !=null and feeId != ''">
  277. and t.fee_id= #{feeId}
  278. </if>
  279. <if test="amountOwed !=null and amountOwed != ''">
  280. and t.amount_owed= #{amountOwed}
  281. </if>
  282. <if test="payerObjName !=null and payerObjName != ''">
  283. and t.payer_obj_name= #{payerObjName}
  284. </if>
  285. <if test="ownerName !=null and ownerName != ''">
  286. and t.owner_name= #{ownerName}
  287. </if>
  288. <if test="configId !=null and configId != ''">
  289. and t.config_id= #{configId}
  290. </if>
  291. <if test='hasOweFee !=null and hasOweFee == "Y"'>
  292. and t.amount_owed &gt; 0
  293. </if>
  294. <if test="configIds !=null">
  295. and t.config_id in
  296. <foreach collection="configIds" item="item" index="index" open="(" close=")" separator=",">
  297. #{item}
  298. </foreach>
  299. </if>
  300. <if test="feeName !=null and feeName != ''">
  301. and t.fee_name= #{feeName}
  302. </if>
  303. <if test="endTime !=null and endTime != ''">
  304. and t.end_time= #{endTime}
  305. </if>
  306. <if test="communityId !=null and communityId != ''">
  307. and t.community_id= #{communityId}
  308. </if>
  309. <if test="payerObjType !=null and payerObjType != ''">
  310. and t.payer_obj_type= #{payerObjType}
  311. </if>
  312. <if test="payerObjId !=null and payerObjId != ''">
  313. and t.payer_obj_id= #{payerObjId}
  314. </if>
  315. <if test="payerObjIds !=null">
  316. and t.payer_obj_id in
  317. <foreach collection="payerObjIds" item="item" index="index" open="(" close=")" separator=",">
  318. #{item}
  319. </foreach>
  320. </if>
  321. order by t.payer_obj_name
  322. <if test="page != -1 and page != null ">
  323. limit #{page}, #{row}
  324. </if>
  325. </select>
  326. <!-- 查询欠费统计信息 add by wuxw 2018-07-03 -->
  327. <select id="queryReportAllOweFeesByRoom" parameterType="Map" resultType="Map">
  328. select t.config_name,t.config_name configName,t.deadline_time,t.deadline_time
  329. deadlineTime,t.owner_tel,t.owner_tel ownerTel,t.update_time,t.update_time updateTime,t.owe_id,t.owe_id
  330. oweId,t.fee_id,t.fee_id feeId,t.amount_owed,t.amount_owed amountOwed,t.payer_obj_name,t.payer_obj_name
  331. payerObjName,t.config_id,t.config_id configId,t.fee_name,t.fee_name
  332. feeName,t.end_time,t.end_time endTime,t.community_id,t.community_id
  333. communityId,t.payer_obj_type,t.payer_obj_type payerObjType,t.payer_obj_id,t.payer_obj_id payerObjId,
  334. bo.owner_id ownerId,bo.name ownerName
  335. from report_owe_fee t
  336. left join building_owner_room_rel borr on borr.room_id = t.payer_obj_id and borr.status_cd = '0'
  337. left join building_owner bo on borr.owner_id = bo.owner_id and bo.owner_type_cd = '1001' and bo.status_cd = '0'
  338. LEFT JOIN pay_fee pf on t.fee_id = pf.fee_id
  339. where 1 =1
  340. and pf.status_cd = '0'
  341. <if test="configName !=null and configName != ''">
  342. and t.config_name= #{configName}
  343. </if>
  344. <if test="deadlineTime !=null and deadlineTime != ''">
  345. and t.deadline_time= #{deadlineTime}
  346. </if>
  347. <if test="ownerTel !=null and ownerTel != ''">
  348. and t.owner_tel= #{ownerTel}
  349. </if>
  350. <if test="updateTime !=null and updateTime != ''">
  351. and t.update_time= #{updateTime}
  352. </if>
  353. <if test="oweId !=null and oweId != ''">
  354. and t.owe_id= #{oweId}
  355. </if>
  356. <if test="ownerId !=null and ownerId != ''">
  357. and bo.owner_id= #{ownerId}
  358. </if>
  359. <if test="feeId !=null and feeId != ''">
  360. and t.fee_id= #{feeId}
  361. </if>
  362. <if test="amountOwed !=null and amountOwed != ''">
  363. and t.amount_owed= #{amountOwed}
  364. </if>
  365. <if test="payerObjName !=null and payerObjName != ''">
  366. and t.payer_obj_name= #{payerObjName}
  367. </if>
  368. <if test="ownerName !=null and ownerName != ''">
  369. and bo.name= #{ownerName}
  370. </if>
  371. <if test="configId !=null and configId != ''">
  372. and t.config_id= #{configId}
  373. </if>
  374. <if test='hasOweFee !=null and hasOweFee == "Y"'>
  375. and t.amount_owed &gt; 0
  376. </if>
  377. <if test="configIds !=null">
  378. and t.config_id in
  379. <foreach collection="configIds" item="item" index="index" open="(" close=")" separator=",">
  380. #{item}
  381. </foreach>
  382. </if>
  383. <if test="feeName !=null and feeName != ''">
  384. and t.fee_name= #{feeName}
  385. </if>
  386. <if test="endTime !=null and endTime != ''">
  387. and t.end_time= #{endTime}
  388. </if>
  389. <if test="communityId !=null and communityId != ''">
  390. and t.community_id= #{communityId}
  391. </if>
  392. <if test="payerObjType !=null and payerObjType != ''">
  393. and t.payer_obj_type= #{payerObjType}
  394. </if>
  395. <if test="payerObjId !=null and payerObjId != ''">
  396. and t.payer_obj_id= #{payerObjId}
  397. </if>
  398. <if test="payerObjIds !=null">
  399. and t.payer_obj_id in
  400. <foreach collection="payerObjIds" item="item" index="index" open="(" close=")" separator=",">
  401. #{item}
  402. </foreach>
  403. </if>
  404. order by t.create_time desc
  405. <if test="page != -1 and page != null ">
  406. limit #{page}, #{row}
  407. </if>
  408. </select>
  409. <!-- 查询欠费统计信息 add by wuxw 2018-07-03 -->
  410. <select id="queryReportAllOweFeesByCar" parameterType="Map" resultType="Map">
  411. select t.config_name,t.config_name configName,t.deadline_time,t.deadline_time
  412. deadlineTime,t.owner_tel,t.owner_tel ownerTel,t.update_time,t.update_time updateTime,t.owe_id,t.owe_id
  413. oweId,t.fee_id,t.fee_id feeId,t.amount_owed,t.amount_owed amountOwed,t.payer_obj_name,t.payer_obj_name
  414. payerObjName,t.config_id,t.config_id configId,t.fee_name,t.fee_name
  415. feeName,t.end_time,t.end_time endTime,t.community_id,t.community_id
  416. communityId,t.payer_obj_type,t.payer_obj_type payerObjType,t.payer_obj_id,t.payer_obj_id payerObjId,
  417. bo.owner_id ownerId,bo.name ownerName
  418. from report_owe_fee t
  419. left join owner_car oc on oc.car_id = t.payer_obj_id and oc.status_cd = '0'
  420. left join building_owner bo on oc.owner_id = bo.owner_id and bo.owner_type_cd = '1001' and bo.status_cd = '0'
  421. LEFT JOIN pay_fee pf on t.fee_id = pf.fee_id
  422. where 1 =1
  423. and pf.status_cd = '0'
  424. <if test="configName !=null and configName != ''">
  425. and t.config_name= #{configName}
  426. </if>
  427. <if test="deadlineTime !=null and deadlineTime != ''">
  428. and t.deadline_time= #{deadlineTime}
  429. </if>
  430. <if test="ownerTel !=null and ownerTel != ''">
  431. and t.owner_tel= #{ownerTel}
  432. </if>
  433. <if test="updateTime !=null and updateTime != ''">
  434. and t.update_time= #{updateTime}
  435. </if>
  436. <if test="oweId !=null and oweId != ''">
  437. and t.owe_id= #{oweId}
  438. </if>
  439. <if test="ownerId !=null and ownerId != ''">
  440. and bo.owner_id= #{ownerId}
  441. </if>
  442. <if test="feeId !=null and feeId != ''">
  443. and t.fee_id= #{feeId}
  444. </if>
  445. <if test="amountOwed !=null and amountOwed != ''">
  446. and t.amount_owed= #{amountOwed}
  447. </if>
  448. <if test="payerObjName !=null and payerObjName != ''">
  449. and t.payer_obj_name= #{payerObjName}
  450. </if>
  451. <if test="ownerName !=null and ownerName != ''">
  452. and bo.name= #{ownerName}
  453. </if>
  454. <if test="configId !=null and configId != ''">
  455. and t.config_id= #{configId}
  456. </if>
  457. <if test='hasOweFee !=null and hasOweFee == "Y"'>
  458. and t.amount_owed &gt; 0
  459. </if>
  460. <if test="configIds !=null">
  461. and t.config_id in
  462. <foreach collection="configIds" item="item" index="index" open="(" close=")" separator=",">
  463. #{item}
  464. </foreach>
  465. </if>
  466. <if test="feeName !=null and feeName != ''">
  467. and t.fee_name= #{feeName}
  468. </if>
  469. <if test="endTime !=null and endTime != ''">
  470. and t.end_time= #{endTime}
  471. </if>
  472. <if test="communityId !=null and communityId != ''">
  473. and t.community_id= #{communityId}
  474. </if>
  475. <if test="payerObjType !=null and payerObjType != ''">
  476. and t.payer_obj_type= #{payerObjType}
  477. </if>
  478. <if test="payerObjId !=null and payerObjId != ''">
  479. and t.payer_obj_id= #{payerObjId}
  480. </if>
  481. <if test="payerObjIds !=null">
  482. and t.payer_obj_id in
  483. <foreach collection="payerObjIds" item="item" index="index" open="(" close=")" separator=",">
  484. #{item}
  485. </foreach>
  486. </if>
  487. order by t.create_time desc
  488. <if test="page != -1 and page != null ">
  489. limit #{page}, #{row}
  490. </if>
  491. </select>
  492. </mapper>