FeeServiceDaoImplMapper.xml 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529
  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="feeServiceDaoImpl">
  6. <!-- 保存费用信息 add by wuxw 2018-07-03 -->
  7. <insert id="saveBusinessFeeInfo" parameterType="Map">
  8. insert into business_pay_fee(
  9. amount,operate,income_obj_id,fee_type_cd,start_time,end_time,community_id,b_id,fee_id,user_id,payer_obj_id,fee_flag,state,config_id,payer_obj_type
  10. ) values (
  11. #{amount},#{operate},#{incomeObjId},#{feeTypeCd},#{startTime},#{endTime},#{communityId},#{bId},#{feeId},#{userId},#{payerObjId},
  12. #{feeFlag},#{state},#{configId},#{payerObjType}
  13. )
  14. </insert>
  15. <!-- 查询费用信息(Business) add by wuxw 2018-07-03 -->
  16. <select id="getBusinessFeeInfo" parameterType="Map" resultType="Map">
  17. select t.amount,t.operate,t.income_obj_id,t.income_obj_id incomeObjId,t.fee_type_cd,t.fee_type_cd
  18. feeTypeCd,t.start_time,t.start_time startTime,t.end_time,t.end_time endTime,t.community_id,t.community_id
  19. communityId,t.b_id,t.b_id bId,t.fee_id,t.fee_id feeId,t.user_id,t.user_id userId,t.payer_obj_id,t.payer_obj_id
  20. payerObjId,t.fee_flag,t.fee_flag feeFlag,t.state,t.config_id,t.config_id
  21. configId,t.payer_obj_type,t.payer_obj_type payerObjType
  22. from business_pay_fee t
  23. where 1 =1
  24. <if test="amount !=null and amount != ''">
  25. and t.amount= #{amount}
  26. </if>
  27. <if test="operate !=null and operate != ''">
  28. and t.operate= #{operate}
  29. </if>
  30. <if test="incomeObjId !=null and incomeObjId != ''">
  31. and t.income_obj_id= #{incomeObjId}
  32. </if>
  33. <if test="feeTypeCd !=null and feeTypeCd != ''">
  34. and t.fee_type_cd= #{feeTypeCd}
  35. </if>
  36. <if test="startTime !=null ">
  37. and t.start_time= #{startTime}
  38. </if>
  39. <if test="endTime !=null ">
  40. and t.end_time= #{endTime}
  41. </if>
  42. <if test="communityId !=null and communityId != ''">
  43. and t.community_id= #{communityId}
  44. </if>
  45. <if test="bId !=null and bId != ''">
  46. and t.b_id= #{bId}
  47. </if>
  48. <if test="feeId !=null and feeId != ''">
  49. and t.fee_id= #{feeId}
  50. </if>
  51. <if test="userId !=null and userId != ''">
  52. and t.user_id= #{userId}
  53. </if>
  54. <if test="payerObjId !=null and payerObjId != ''">
  55. and t.payer_obj_id= #{payerObjId}
  56. </if>
  57. <if test="state !=null and state != ''">
  58. and t.state= #{state}
  59. </if>
  60. <if test="feeFlag !=null and feeFlag != ''">
  61. and t.fee_flag= #{feeFlag}
  62. </if>
  63. <if test="configId !=null and configId != ''">
  64. and t.config_id= #{configId}
  65. </if>
  66. <if test="payerObjType !=null and payerObjType != ''">
  67. and t.payer_obj_type = #{payerObjType}
  68. </if>
  69. </select>
  70. <!-- 保存费用信息至 instance表中 add by wuxw 2018-07-03 -->
  71. <insert id="saveFeeInfoInstance" parameterType="Map">
  72. insert into pay_fee(
  73. amount,income_obj_id,fee_type_cd,start_time,status_cd,end_time,community_id,b_id,fee_id,user_id,payer_obj_id,fee_flag,state,config_id,payer_obj_type
  74. ) select
  75. t.amount,t.income_obj_id,t.fee_type_cd,t.start_time,'0',t.end_time,t.community_id,t.b_id,t.fee_id,t.user_id,t.payer_obj_id
  76. ,t.fee_flag,t.state,t.config_id,t.payer_obj_type
  77. from business_pay_fee t where 1=1
  78. <if test="amount !=null and amount != ''">
  79. and t.amount= #{amount}
  80. </if>
  81. and t.operate= 'ADD'
  82. <if test="incomeObjId !=null and incomeObjId != ''">
  83. and t.income_obj_id= #{incomeObjId}
  84. </if>
  85. <if test="feeTypeCd !=null and feeTypeCd != ''">
  86. and t.fee_type_cd= #{feeTypeCd}
  87. </if>
  88. <if test="startTime !=null ">
  89. and t.start_time= #{startTime}
  90. </if>
  91. <if test="endTime !=null ">
  92. and t.end_time= #{endTime}
  93. </if>
  94. <if test="communityId !=null and communityId != ''">
  95. and t.community_id= #{communityId}
  96. </if>
  97. <if test="bId !=null and bId != ''">
  98. and t.b_id= #{bId}
  99. </if>
  100. <if test="feeId !=null and feeId != ''">
  101. and t.fee_id= #{feeId}
  102. </if>
  103. <if test="userId !=null and userId != ''">
  104. and t.user_id= #{userId}
  105. </if>
  106. <if test="payerObjId !=null and payerObjId != ''">
  107. and t.payer_obj_id= #{payerObjId}
  108. </if>
  109. <if test="state !=null and state != ''">
  110. and t.state= #{state}
  111. </if>
  112. <if test="feeFlag !=null and feeFlag != ''">
  113. and t.fee_flag= #{feeFlag}
  114. </if>
  115. <if test="configId !=null and configId != ''">
  116. and t.config_id= #{configId}
  117. </if>
  118. <if test="payerObjType !=null and payerObjType != ''">
  119. and t.payer_obj_type = #{payerObjType}
  120. </if>
  121. </insert>
  122. <!-- 查询费用信息 add by wuxw 2018-07-03 -->
  123. <select id="getFeeInfo" parameterType="Map" resultType="Map">
  124. select t.amount,t.income_obj_id,t.income_obj_id incomeObjId,t.fee_type_cd,t.fee_type_cd
  125. feeTypeCd,t.start_time,t.start_time startTime,t.status_cd,t.status_cd statusCd,t.end_time,t.end_time
  126. endTime,t.community_id,t.community_id communityId,t.b_id,t.b_id bId,t.fee_id,t.fee_id feeId,t.user_id,t.user_id
  127. userId,t.payer_obj_id,t.payer_obj_id payerObjId,pfc.square_price squarePrice,pfc.additional_amount
  128. additionalAmount,t.fee_flag,t.fee_flag feeFlag,t.state,t.config_id,t.config_id configId,
  129. pfc.fee_name feeName,td1.name feeTypeCdName,td2.name stateName,td3.name feeFlagName,pfc.computing_formula
  130. computingFormula,
  131. t.payer_obj_type,t.payer_obj_type payerObjType,pfc.is_default isDefault,pfc.start_time
  132. configStartTime,pfc.end_time configEndTime
  133. from pay_fee t,pay_fee_config pfc,t_dict td1,t_dict td2,t_dict td3
  134. where 1 =1
  135. and t.fee_type_cd = pfc.fee_type_cd
  136. and t.config_id = pfc.config_id
  137. and pfc.status_cd = '0'
  138. and pfc.fee_type_cd = td1.status_cd
  139. and td1.table_name = 'pay_fee_config'
  140. and td1.table_columns = 'fee_type_cd'
  141. and t.state = td2.status_cd
  142. and td2.table_name = 'pay_fee'
  143. and td2.table_columns = 'state'
  144. and t.fee_flag = td3.status_cd
  145. and td3.table_name = 'pay_fee'
  146. and td3.table_columns = 'fee_flag'
  147. <if test="amount !=null and amount != ''">
  148. and t.amount= #{amount}
  149. </if>
  150. <if test="incomeObjId !=null and incomeObjId != ''">
  151. and t.income_obj_id= #{incomeObjId}
  152. </if>
  153. <if test="feeTypeCd !=null and feeTypeCd != ''">
  154. and t.fee_type_cd= #{feeTypeCd}
  155. </if>
  156. <if test="feeTypeCds != null ">
  157. and t.fee_type_cd in
  158. <foreach collection="feeTypeCds" item="item" open="(" close=")" separator=",">
  159. #{item}
  160. </foreach>
  161. </if>
  162. <if test="startTime !=null ">
  163. and t.start_time= #{startTime}
  164. </if>
  165. <if test="statusCd !=null and statusCd != ''">
  166. and t.status_cd= #{statusCd}
  167. </if>
  168. <if test="endTime !=null ">
  169. and t.end_time= #{endTime}
  170. </if>
  171. <if test="arrearsEndTime != null">
  172. and t.end_time &lt; #{arrearsEndTime}
  173. </if>
  174. <if test="communityId !=null and communityId != ''">
  175. and t.community_id= #{communityId}
  176. and pfc.community_id= #{communityId}
  177. </if>
  178. <if test="bId !=null and bId != ''">
  179. and t.b_id= #{bId}
  180. </if>
  181. <if test="feeId !=null and feeId != ''">
  182. and t.fee_id= #{feeId}
  183. </if>
  184. <if test="userId !=null and userId != ''">
  185. and t.user_id= #{userId}
  186. </if>
  187. <if test="payerObjId !=null and payerObjId != ''">
  188. and t.payer_obj_id= #{payerObjId}
  189. </if>
  190. <if test="payerObjIds != null ">
  191. and t.payer_obj_id in
  192. <foreach collection="payerObjIds" item="item" open="(" close=")" separator=",">
  193. #{item}
  194. </foreach>
  195. </if>
  196. <if test="state !=null and state != ''">
  197. and t.state= #{state}
  198. </if>
  199. <if test="feeFlag !=null and feeFlag != ''">
  200. and t.fee_flag= #{feeFlag}
  201. </if>
  202. <if test="configId !=null and configId != ''">
  203. and t.config_id= #{configId}
  204. </if>
  205. <if test="payerObjType !=null and payerObjType != ''">
  206. and t.payer_obj_type = #{payerObjType}
  207. </if>
  208. order by t.create_time desc
  209. <if test="page != -1 and page != null ">
  210. limit #{page}, #{row}
  211. </if>
  212. </select>
  213. <!-- 修改费用信息 add by wuxw 2018-07-03 -->
  214. <update id="updateFeeInfoInstance" parameterType="Map">
  215. update pay_fee t set t.status_cd = #{statusCd}
  216. <if test="newBId != null and newBId != ''">
  217. ,t.b_id = #{newBId}
  218. </if>
  219. <if test="amount !=null and amount != ''">
  220. , t.amount= #{amount}
  221. </if>
  222. <if test="incomeObjId !=null and incomeObjId != ''">
  223. , t.income_obj_id= #{incomeObjId}
  224. </if>
  225. <if test="feeTypeCd !=null and feeTypeCd != ''">
  226. , t.fee_type_cd= #{feeTypeCd}
  227. </if>
  228. <if test="startTime !=null ">
  229. , t.start_time= #{startTime}
  230. </if>
  231. <if test="endTime !=null">
  232. , t.end_time= #{endTime}
  233. </if>
  234. <if test="communityId !=null and communityId != ''">
  235. , t.community_id= #{communityId}
  236. </if>
  237. <if test="userId !=null and userId != ''">
  238. , t.user_id= #{userId}
  239. </if>
  240. <if test="payerObjId !=null and payerObjId != ''">
  241. , t.payer_obj_id= #{payerObjId}
  242. </if>
  243. <if test="state !=null and state != ''">
  244. , t.state= #{state}
  245. </if>
  246. <if test="feeFlag !=null and feeFlag != ''">
  247. , t.fee_flag= #{feeFlag}
  248. </if>
  249. where 1=1
  250. <if test="bId !=null and bId != ''">
  251. and t.b_id= #{bId}
  252. </if>
  253. <if test="feeId !=null and feeId != ''">
  254. and t.fee_id= #{feeId}
  255. </if>
  256. </update>
  257. <!-- 查询费用数量 add by wuxw 2018-07-03 -->
  258. <select id="queryFeesCount" parameterType="Map" resultType="Map">
  259. select count(1) count
  260. from pay_fee t,pay_fee_config pfc,t_dict td1,t_dict td2,t_dict td3
  261. where 1 =1
  262. and t.fee_type_cd = pfc.fee_type_cd
  263. and t.config_id = pfc.config_id
  264. and pfc.status_cd = '0'
  265. and pfc.fee_type_cd = td1.status_cd
  266. and td1.table_name = 'pay_fee_config'
  267. and td1.table_columns = 'fee_type_cd'
  268. and t.state = td2.status_cd
  269. and td2.table_name = 'pay_fee'
  270. and td2.table_columns = 'state'
  271. and t.fee_flag = td3.status_cd
  272. and td3.table_name = 'pay_fee'
  273. and td3.table_columns = 'fee_flag'
  274. <if test="amount !=null and amount != ''">
  275. and t.amount= #{amount}
  276. </if>
  277. <if test="incomeObjId !=null and incomeObjId != ''">
  278. and t.income_obj_id= #{incomeObjId}
  279. </if>
  280. <if test="feeTypeCd !=null and feeTypeCd != ''">
  281. and t.fee_type_cd= #{feeTypeCd}
  282. </if>
  283. <if test="feeTypeCds != null ">
  284. and t.fee_type_cd in
  285. <foreach collection="feeTypeCds" item="item" open="(" close=")" separator=",">
  286. #{item}
  287. </foreach>
  288. </if>
  289. <if test="startTime !=null">
  290. and t.start_time= #{startTime}
  291. </if>
  292. <if test="statusCd !=null and statusCd != ''">
  293. and t.status_cd= #{statusCd}
  294. </if>
  295. <if test="endTime !=null ">
  296. and t.end_time= #{endTime}
  297. </if>
  298. <if test="arrearsEndTime != null">
  299. and t.end_time &lt; #{arrearsEndTime}
  300. </if>
  301. <if test="noArrearsEndTime != null">
  302. and t.end_time &gt; #{noArrearsEndTime}
  303. </if>
  304. <if test="communityId !=null and communityId != ''">
  305. and t.community_id= #{communityId}
  306. and pfc.community_id= #{communityId}
  307. </if>
  308. <if test="bId !=null and bId != ''">
  309. and t.b_id= #{bId}
  310. </if>
  311. <if test="feeId !=null and feeId != ''">
  312. and t.fee_id= #{feeId}
  313. </if>
  314. <if test="userId !=null and userId != ''">
  315. and t.user_id= #{userId}
  316. </if>
  317. <if test="payerObjId !=null and payerObjId != ''">
  318. and t.payer_obj_id= #{payerObjId}
  319. </if>
  320. <if test="payerObjIds != null ">
  321. and t.payer_obj_id in
  322. <foreach collection="payerObjIds" item="item" open="(" close=")" separator=",">
  323. #{item}
  324. </foreach>
  325. </if>
  326. <if test="state !=null and state != ''">
  327. and t.state= #{state}
  328. </if>
  329. <if test="feeFlag !=null and feeFlag != ''">
  330. and t.fee_flag= #{feeFlag}
  331. </if>
  332. <if test="configId !=null and configId != ''">
  333. and t.config_id= #{configId}
  334. </if>
  335. <if test="payerObjType !=null and payerObjType != ''">
  336. and t.payer_obj_type = #{payerObjType}
  337. </if>
  338. </select>
  339. <!-- 查询账期 -->
  340. <select id="queryBills" parameterType="Map" resultType="Map">
  341. select
  342. t.bill_id billId,
  343. t.bill_name billName,
  344. t.receivable,
  345. t.receipts,
  346. t.bill_time billTime,
  347. t.community_id communityId,
  348. t.config_id configId,
  349. t.cur_bill curBill
  350. from bill t
  351. where 1 =1
  352. <if test="billId !=null and billId != ''">
  353. and t.bill_id= #{billId}
  354. </if>
  355. <if test="billName !=null and billName != ''">
  356. and t.bill_name= #{billName}
  357. </if>
  358. <if test="receivable !=null and receivable != ''">
  359. and t.receivable= #{receivable}
  360. </if>
  361. <if test="receipts !=null">
  362. and t.receipts= #{receipts}
  363. </if>
  364. <if test="billTime !=null">
  365. and t.bill_time= #{billTime}
  366. </if>
  367. <if test="communityId !=null and communityId != ''">
  368. and t.community_id= #{communityId}
  369. </if>
  370. <if test="configId != null and configId != ''">
  371. and t.config_id = #{configId}
  372. </if>
  373. <if test="curBill != null and curBill != ''">
  374. and t.cur_bill = #{curBill}
  375. </if>
  376. order by t.create_time desc
  377. <if test="page != -1 and page != null ">
  378. limit #{page}, #{row}
  379. </if>
  380. </select>
  381. <!-- 查询账期 -->
  382. <select id="queryBillCount" parameterType="Map" resultType="Map">
  383. select count(1) count
  384. from bill t
  385. where 1 =1
  386. <if test="billId !=null and billId != ''">
  387. and t.bill_id= #{billId}
  388. </if>
  389. <if test="billName !=null and billName != ''">
  390. and t.bill_name= #{billName}
  391. </if>
  392. <if test="receivable !=null and receivable != ''">
  393. and t.receivable= #{receivable}
  394. </if>
  395. <if test="curReceivable !=null and curReceivable != ''">
  396. and t.cur_receivable= #{curReceivable}
  397. </if>
  398. <if test="receipts !=null">
  399. and t.receipts= #{receipts}
  400. </if>
  401. <if test="billTime !=null">
  402. and t.bill_time= #{billTime}
  403. </if>
  404. <if test="communityId !=null and communityId != ''">
  405. and t.community_id= #{communityId}
  406. </if>
  407. <if test="configId != null and configId != ''">
  408. and t.config_id = #{configId}
  409. </if>
  410. <if test="curBill != null and curBill != ''">
  411. and t.cur_bill = #{curBill}
  412. </if>
  413. </select>
  414. <!-- 查询账期 -->
  415. <select id="queryBillOweFees" parameterType="Map" resultType="Map">
  416. select
  417. t.owe_id oweId,
  418. t.bill_id billId,
  419. t.fee_id feeId,
  420. t.bill_amount_owed billAmountOwed,
  421. t.amount_owed amountOwed,
  422. t.fee_end_time feeEndTime,
  423. t.owner_id ownerId,
  424. t.owner_name ownerName,
  425. t.owner_tel ownerTel,
  426. t.payer_obj_name payerObjName,
  427. t.payer_obj_type payerObjType,
  428. t.community_id communityId,
  429. t.state,
  430. t.create_time createTime
  431. from bill_owe_fee t
  432. where 1 =1
  433. <if test="oweId !=null and oweId != ''">
  434. and t.owe_id= #{oweId}
  435. </if>
  436. <if test="billId !=null and billId != ''">
  437. and t.bill_id= #{billId}
  438. </if>
  439. <if test="feeId !=null and feeId != ''">
  440. and t.fee_id= #{feeId}
  441. </if>
  442. <if test="billAmountOwed !=null and billAmountOwed != ''">
  443. and t.bill_amount_owed= #{billAmountOwed}
  444. </if>
  445. <if test="amountOwed !=null and amountOwed != ''">
  446. and t.amount_owed= #{amountOwed}
  447. </if>
  448. <if test="feeEndTime != null">
  449. and t.fee_end_time = #{feeEndTime}
  450. </if>
  451. <if test="ownerId != null and ownerId != ''">
  452. and t.owner_id = #{ownerId}
  453. </if>
  454. <if test="ownerName != null and ownerName != ''">
  455. and t.owner_name = #{ownerName}
  456. </if>
  457. <if test="communityId !=null and communityId != ''">
  458. and t.community_id= #{communityId}
  459. </if>
  460. <if test="state !=null and state != ''">
  461. and t.state= #{state}
  462. </if>
  463. order by t.create_time desc
  464. <if test="page != -1 and page != null ">
  465. limit #{page}, #{row}
  466. </if>
  467. </select>
  468. <!-- 查询账期 -->
  469. <select id="queryBillOweFeeCount" parameterType="Map" resultType="Map">
  470. select count(1) count
  471. from bill_owe_fee t
  472. where 1 =1
  473. <if test="oweId !=null and oweId != ''">
  474. and t.owe_id= #{oweId}
  475. </if>
  476. <if test="billId !=null and billId != ''">
  477. and t.bill_id= #{billId}
  478. </if>
  479. <if test="feeId !=null and feeId != ''">
  480. and t.fee_id= #{feeId}
  481. </if>
  482. <if test="billAmountOwed !=null and billAmountOwed != ''">
  483. and t.bill_amount_owed= #{billAmountOwed}
  484. </if>
  485. <if test="amountOwed !=null and amountOwed != ''">
  486. and t.amount_owed= #{amountOwed}
  487. </if>
  488. <if test="feeEndTime != null">
  489. and t.fee_end_time = #{feeEndTime}
  490. </if>
  491. <if test="ownerId != null and ownerId != ''">
  492. and t.owner_id = #{ownerId}
  493. </if>
  494. <if test="ownerName != null and ownerName != ''">
  495. and t.owner_name = #{ownerName}
  496. </if>
  497. <if test="communityId !=null and communityId != ''">
  498. and t.community_id= #{communityId}
  499. </if>
  500. <if test="state !=null and state != ''">
  501. and t.state= #{state}
  502. </if>
  503. </select>
  504. </mapper>