PaySelectMapper.xml 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3. <mapper namespace="com.tofly.feesapi.wxgl.wechatpay.mapper.PaySelectMapper">
  4. <select id="getDhYhqfxx" resultType="com.tofly.feesapi.wxgl.wechatpay.entity.vo.PaySelectQfVo">
  5. select
  6. nvl(a.zyssl,0) zyssl,
  7. nvl(a.zyssf,0) zyssf,
  8. nvl(a.zyswsf,0) zyswsf,
  9. nvl(a.zysljf,0) zysljf,
  10. nvl(a.zysszyf,0) zysszyf,
  11. nvl(a.zznj,0) zznj,
  12. nvl(a.zysje,0) zysje,
  13. nvl(a.bcds,0) bcds,
  14. GREATEST(NVL(a.zysje, 0) - NVL(d.syje, 0), 0) AS yjje,
  15. b.yhbh ,b.yhxm ,b.yhdz ,b.lxdh,d.syje,d.nbsyje,c.sbbh
  16. from yh_khjbxx b
  17. left join yh_cbkxx c on b.yhbh=c.yhbh
  18. left join yy_zjzh d on b.yhbh=d.yhbh
  19. left join (
  20. select #{payselect.yhbh} as yhbh,sum(nvl(yssl,0)) zyssl,sum(nvl(yssf,0)) zyssf,sum(nvl(yswsf,0))
  21. zyswsf,sum(nvl(ysljf,0))
  22. zysljf,sum(nvl(ysszyf,0)) zysszyf,
  23. sum(nvl(znj,0)) zznj,
  24. sum(nvl(ysje, 0) + nvl(znj, 0)) zysje,
  25. max(bcds) bcds
  26. from yy_qfmx where sfbz=0 and chbz=0
  27. and yhbh in (
  28. select yhbh from yh_khjbxx where khbm=#{khbm}
  29. )) a on b.yhbh=a.yhbh
  30. where 1=1
  31. <if test="payselect.yhbh!=null">
  32. AND b.yhbh = #{payselect.yhbh}
  33. </if>
  34. </select>
  35. <select id="getYhqfxx" resultType="com.tofly.feesapi.wxgl.wechatpay.entity.vo.PaySelectQfVo">
  36. SELECT
  37. nvl(a.zyssl,0) zyssl,
  38. nvl(a.zyssf,0) zyssf,
  39. nvl(a.zyswsf,0) zyswsf,
  40. nvl(a.zysljf,0) zysljf,
  41. nvl(a.zysszyf,0) zysszyf,
  42. nvl(a.zznj,0) zznj,
  43. nvl(a.zysje,0) zysje,
  44. nvl(a.bcds,0) bcds,
  45. GREATEST(NVL(a.zysje, 0) - NVL(d.syje, 0), 0) AS yjje,
  46. b.yhbh, b.yhxm, b.yhdz, b.lxdh, d.syje,d.nbsyje, c.sbbh, b.dxh
  47. from yh_khjbxx b
  48. left join (select yhbh,LISTAGG(sbbh, ',') WITHIN GROUP (ORDER BY sbbh)sbbh from yh_cbkxx
  49. <where>
  50. <if test="payselect.yhbh!=null">
  51. AND yhbh = #{payselect.yhbh}
  52. </if>
  53. </where>
  54. group by yhbh
  55. ) c on b.yhbh=c.yhbh
  56. left join yy_zjzh d on b.yhbh = d.yhbh
  57. left join (
  58. select
  59. yhbh, sum(nvl(yssl, 0)) zyssl, sum(nvl(yssf, 0)) zyssf,
  60. sum(nvl(yswsf, 0)) zyswsf, sum(nvl(ysljf, 0))
  61. zysljf, sum(nvl(ysszyf, 0)) zysszyf,
  62. sum(nvl(znj, 0)) zznj,
  63. sum(nvl(ysje, 0) + nvl(znj, 0)) zysje,
  64. max(bcds) bcds
  65. FROM
  66. yy_qfmx where sfbz = 0 and chbz = 0
  67. <if test="payselect.yhbh!=null">
  68. AND yhbh = #{payselect.yhbh}
  69. </if>
  70. GROUP BY yhbh
  71. ) a ON b.yhbh = a.yhbh
  72. where 1=1
  73. <if test="payselect.yhbh!=null">
  74. AND b.yhbh = #{payselect.yhbh}
  75. </if>
  76. </select>
  77. <select id="getOrderStatus" resultType="com.tofly.feesapi.wxgl.wechatpay.entity.vo.PaySelectOrderStatusVo">
  78. select yhbh, case when sfbz='1' then '已缴费' else '已作废' end orderstatus
  79. from yy_sspjxx a
  80. where rownum = '1'
  81. <if test="payselect.yhbh!=null">
  82. AND a.yhbh = '${payselect.yhbh}'
  83. </if>
  84. <if test="payselect.sflsbh!=null">
  85. AND a.sflsbh = '${payselect.sflsbh}'
  86. </if>
  87. </select>
  88. <select id="getSfmxList" resultType="com.tofly.feesapi.wxgl.wechatpay.entity.vo.PaySelectSfxmVo">
  89. select yhbh,sfrybm,sfrq,sflsbh,sszje from yy_sspjxx a
  90. where 1=1
  91. <if test="payselect.sfrybm!=null">
  92. AND a.sfrybm = '${payselect.sfrybm}'
  93. </if>
  94. <if test="payselect.sfrq!=null">
  95. AND a.sfrq > to_date('${payselect.sfrq} 00:00:00','yyyy-MM-dd hh24:mi:ss') and a.sfrq &lt;=
  96. to_date('${payselect.sfrq} 23:59:59','yyyy-MM-dd hh24:mi:ss')
  97. </if>
  98. order by a.sfrq desc
  99. </select>
  100. <select id="getYhSfmxList" resultType="com.tofly.feesapi.wxgl.wechatpay.entity.vo.PaySelectSfxmVo">
  101. select yhbh,sfryxm,min(sfrq) sfrq,sflsbh,sum(nvl(sszje,0)) sszje from yy_sspjxx a
  102. where 1=1 AND a.chbz='0' AND a.sflx in ('2','3','4','5','6') and a.sszje>0
  103. <if test="payselect.yhbh!=null">
  104. AND a.yhbh = '${payselect.yhbh}'
  105. </if>
  106. group by a.yhbh,a.sflsbh,a.sfryxm
  107. order by a.sfrq desc
  108. </select>
  109. <select id="getYhCbmxList" resultType="com.tofly.feesapi.wxgl.wechatpay.entity.vo.QfSelectCbxmVo">
  110. select yhbh,ysyf,to_char(SCDS)||'-'||to_char(BCDS) qzds,yssl,yssf,yswsf,ysljf,ysszyf,ysje,znj,ysje+znj hjje,case
  111. when sfbz='0'then '未收' else '已收' end sfbz from yy_qfmx a
  112. where 1=1 AND a.chbz='0'
  113. <if test="payselect.yhbh!=null">
  114. AND a.yhbh = '${payselect.yhbh}'
  115. </if>
  116. order by a.ysyf desc
  117. </select>
  118. <select id="getYhxxList" resultType="com.tofly.feesapi.wxgl.wechatpay.entity.vo.YhSelectxxVo">
  119. select nvl(a.zyssl,0) yssl,nvl(a.zyssf,0) yssf,nvl(a.zyswsf,0) yswsf,nvl(a.zysljf,0) ysljf,nvl(a.zysszyf,0)
  120. ysszyf,nvl(a.zznj,0) znj,nvl(a.zysje,0) ysje,nvl(a.bcds,0) bcds,
  121. case when (nvl(a.zysje,0)-nvl(d.syje,0)&lt;0) then 0 else (nvl(a.zysje,0)-nvl(d.syje,0)) end yjje,
  122. b.yhbh ,b.yhxm ,b.yhdz ,b.lxdh,b.djrq,d.syje,c.sbbh,e.name ysxz,f.name sblb,JTZQLJL nljl,jtbz,nvl(JT1_ZS,0)
  123. jt1,nvl(JT2_ZS,0) jt2,
  124. nvl(jt1_sj,0) jt1dj,nvl(jt2_sj,0) jt2dj,nvl(jt3_sj,0) jt3dj,
  125. case when JTZQLJL>nvl(JT2_ZS,0) then nvl(JT1_ZS,0) when JTZQLJL &lt;= nvl(JT2_ZS,0) and JTZQLJL>nvl(JT1_ZS,0)
  126. then nvl(JT1_ZS,0) else JTZQLJL end jtsyl1,
  127. case when JTZQLJL>nvl(JT2_ZS,0) then nvl(JT2_ZS,0) - nvl(JT1_ZS,0) when JTZQLJL&lt;= nvl(JT2_ZS,0) and
  128. JTZQLJL>nvl(JT1_ZS,0) then JTZQLJL - nvl(JT1_ZS,0) else 0 end jtsyl2,
  129. case when JTZQLJL>nvl(JT2_ZS,0) then JTZQLJL-nvl(JT2_ZS,0) else 0 end jtsyl3,
  130. from yh_khjbxx b
  131. left join yh_cbkxx c on b.yhbh=c.yhbh
  132. left join yy_zjzh d on b.yhbh=d.yhbh
  133. left join BM_SJ e on c.SJBM = e.code
  134. left join BM_SBLB f on c.SBLB = f.code
  135. left join (
  136. select yhbh,sum(nvl(yssl,0)) zyssl,sum(nvl(yssf,0)) zyssf,sum(nvl(yswsf,0)) zyswsf,sum(nvl(ysljf,0))
  137. zysljf,sum(nvl(ysszyf,0)) zysszyf,
  138. sum(nvl(znj,0)) zznj,sum(nvl(ysje,0))+sum(nvl(znj,0)) zysje,max(a.bcds) bcds
  139. from yy_qfmx a where a.sfbz=0 and a.chbz=0
  140. group by a.yhbh ) a on b.yhbh=a.yhbh
  141. where 1=1 and b.yhzt not in ('0','3','4')
  142. <if test="payselect.yhbh!=null">
  143. AND b.yhbh = #{payselect.yhbh}
  144. </if>
  145. </select>
  146. </mapper>