RefundNoticeMapper.xml 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  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.unis.transaction.server.dao.RefundNoticeDao">
  4. <sql id="baseColumns">
  5. r.id,r.htbm,r.lysl,r.zt,r.zt_name,r.gz,r.gzrq,r.gzr,r.gzrbh,r.sfjs,r.jsyj,r.jsr,r.jsrbh,r.jsrq,r.lylx,r.tzzw,r.wysl
  6. </sql>
  7. <sql id="contractColumns">
  8. ht.htbh as htbh,ht.jylx as htlx,ht.sgdw,ht.pzmc,ht.pzbm,ht.lssl as cjsl,ht.cckmc,ht.cckdm,ht.cjrq,ht.ccbm,ht.apcc,ht.prompt_date as lyjzrq,ht.cjdj as jydj,ht.je as jyje,
  9. CASE ht.jylx
  10. WHEN '0' THEN ht.cmmc
  11. WHEN '1' THEN ht.sgmc
  12. ELSE NULL
  13. END as sgmc
  14. </sql>
  15. <select id="selectList" resultType="com.unis.transaction.common.vo.tradeplan.RefundNoticeVO"
  16. parameterType="com.unis.transaction.common.vo.tradeplan.RefundNoticeQueryVO">
  17. SELECT
  18. <include refid="baseColumns" />,
  19. <include refid="contractColumns" />,cc.jybzj,cc.lybzj
  20. FROM ty_refund_notice r
  21. LEFT JOIN ty_jyht ht on r.htbm = ht.htbm
  22. LEFT JOIN ty_jycc cc on ht.ccbm = cc.ccbm
  23. <where>
  24. r.lylx = #{lylx}
  25. <if test="htbm != null and htbm != ''">
  26. and (r.htbm like '%'||#{htbm}||'%' or ht.htbh like '%'||#{htbm}||'%')
  27. </if>
  28. <if test="cckmc != null and cckmc != ''">
  29. and ht.cckmc like '%'||#{cckmc}||'%'
  30. </if>
  31. <if test="kssj != null">
  32. and to_date(ht.prompt_date,'yyyy-mm-dd') &gt;= #{kssj}
  33. </if>
  34. <if test="jssj != null ">
  35. and to_date(ht.prompt_date,'yyyy-mm-dd') &lt;= #{jssj}
  36. </if>
  37. <if test="pzmc != null and pzmc != ''">
  38. and ht.pzmc like '%'||#{pzmc}||'%'
  39. </if>
  40. <if test="pzbm != null and pzbm != ''">
  41. and ht.pzbm = #{pzbm}
  42. </if>
  43. <if test="zt != null and zt != ''">
  44. and r.zt = #{zt}
  45. </if>
  46. <if test="orgCode != null and orgCode != '' and type != 2">
  47. and ht.fsdw like #{orgCode}||'%'
  48. </if>
  49. <if test="type != null and type == 2">
  50. and (r.zt in ('92000300','92000400','92000500') or r.htbm in (select l.htbm from ty_refund_letter l where l.status = 1 and l.zt in ('92000300','92000400','92000500')))
  51. </if>
  52. <if test="sgmc != null and sgmc != ''">
  53. and (instr(decode(ht.jylx, 0, ht.cmmc, 1, ht.sgmc), #{sgmc}) > 0)
  54. </if>
  55. <if test="htlx != null">
  56. and ht.jylx = #{htlx}
  57. </if>
  58. <if test="cjkssj != null">
  59. and to_date(ht.cjrq,'yyyy-mm-dd') &gt;= #{cjkssj}
  60. </if>
  61. <if test="cjjssj != null ">
  62. and to_date(ht.cjrq,'yyyy-mm-dd') &lt;= #{cjjssj}
  63. </if>
  64. <if test="apcc != null ">
  65. and ht.apcc like '%'||#{apcc}||'%'
  66. </if>
  67. </where>
  68. order by r.create_date desc,r.htbm asc
  69. </select>
  70. <select id="selectContractList" resultType="com.unis.transaction.common.vo.tradeplan.RefundNoticeContractVO"
  71. parameterType="com.unis.transaction.common.vo.tradeplan.RefundNoticeQueryVO">
  72. SELECT
  73. <include refid="contractColumns" />,cc.jybzj,cc.lybzj,ht.htbm
  74. FROM ty_jyht ht
  75. LEFT JOIN ty_jycc cc on ht.ccbm = cc.ccbm
  76. <where>
  77. (ht.refund_status = 0 or ht.refund_status is null)
  78. <if test="htbm != null and htbm != ''">
  79. and ht.htbh like '%'||#{htbm}||'%'
  80. </if>
  81. <if test="cckmc != null and cckmc != ''">
  82. and ht.cckmc like '%'||#{cckmc}||'%'
  83. </if>
  84. <if test="kssj != null">
  85. and to_date(ht.prompt_date,'yyyy-mm-dd') &gt;= #{kssj}
  86. </if>
  87. <if test="jssj != null ">
  88. and to_date(ht.prompt_date,'yyyy-mm-dd') &lt;= #{jssj}
  89. </if>
  90. <if test="pzmc != null and pzmc != ''">
  91. and ht.pzmc like '%'||#{pzmc}||'%'
  92. </if>
  93. <if test="pzbm != null and pzbm != ''">
  94. and ht.pzbm = #{pzbm}
  95. </if>
  96. <if test="orgCode != null and orgCode != ''">
  97. and ht.fsdw like #{orgCode}||'%'
  98. </if>
  99. <if test="sgmc != null and sgmc != ''">
  100. and (instr(decode(ht.jylx, 0, ht.cmmc, 1, ht.sgmc), #{sgmc}) > 0)
  101. </if>
  102. <if test="cjkssj != null">
  103. and to_date(ht.cjrq,'yyyy-mm-dd') &gt;= #{cjkssj}
  104. </if>
  105. <if test="cjjssj != null ">
  106. and to_date(ht.cjrq,'yyyy-mm-dd') &lt;= #{cjjssj}
  107. </if>
  108. <if test="apcc != null ">
  109. and ht.apcc like '%'||#{apcc}||'%'
  110. </if>
  111. </where>
  112. order by ht.create_date desc
  113. </select>
  114. <update id="updateHtRefundStatusByHtbm">
  115. update ty_jyht
  116. set refund_status = #{refundStatus}
  117. where htbm = #{htbm}
  118. </update>
  119. <select id="selectByHtbm" resultType="com.unis.transaction.common.vo.tradeplan.RefundNoticeContractVO">
  120. SELECT
  121. <include refid="baseColumns" />,
  122. <include refid="contractColumns" />,cc.jybzj,cc.lybzj
  123. FROM ty_refund_notice r
  124. LEFT JOIN ty_jyht ht on r.htbm = ht.htbm
  125. LEFT JOIN ty_jycc cc on ht.ccbm = cc.ccbm
  126. <where>
  127. r.status = 1 and r.htbm = #{htbm}
  128. </where>
  129. </select>
  130. </mapper>