123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142 |
- <?xml version="1.0" encoding="UTF-8" ?>
- <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
- <mapper namespace="com.unis.transaction.server.dao.RefundNoticeDao">
-
- <sql id="baseColumns">
- 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
- </sql>
-
- <sql id="contractColumns">
- 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,
- CASE ht.jylx
- WHEN '0' THEN ht.cmmc
- WHEN '1' THEN ht.sgmc
- ELSE NULL
- END as sgmc
- </sql>
-
-
- <select id="selectList" resultType="com.unis.transaction.common.vo.tradeplan.RefundNoticeVO"
- parameterType="com.unis.transaction.common.vo.tradeplan.RefundNoticeQueryVO">
- SELECT
- <include refid="baseColumns" />,
- <include refid="contractColumns" />,cc.jybzj,cc.lybzj
- FROM ty_refund_notice r
- LEFT JOIN ty_jyht ht on r.htbm = ht.htbm
- LEFT JOIN ty_jycc cc on ht.ccbm = cc.ccbm
- <where>
- r.lylx = #{lylx}
- <if test="htbm != null and htbm != ''">
- and (r.htbm like '%'||#{htbm}||'%' or ht.htbh like '%'||#{htbm}||'%')
- </if>
- <if test="cckmc != null and cckmc != ''">
- and ht.cckmc like '%'||#{cckmc}||'%'
- </if>
- <if test="kssj != null">
- and to_date(ht.prompt_date,'yyyy-mm-dd') >= #{kssj}
- </if>
- <if test="jssj != null ">
- and to_date(ht.prompt_date,'yyyy-mm-dd') <= #{jssj}
- </if>
- <if test="pzmc != null and pzmc != ''">
- and ht.pzmc like '%'||#{pzmc}||'%'
- </if>
- <if test="pzbm != null and pzbm != ''">
- and ht.pzbm = #{pzbm}
- </if>
- <if test="zt != null and zt != ''">
- and r.zt = #{zt}
- </if>
- <if test="orgCode != null and orgCode != '' and type != 2">
- and ht.fsdw like #{orgCode}||'%'
- </if>
- <if test="type != null and type == 2">
- 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')))
- </if>
- <if test="sgmc != null and sgmc != ''">
- and (instr(decode(ht.jylx, 0, ht.cmmc, 1, ht.sgmc), #{sgmc}) > 0)
- </if>
- <if test="htlx != null">
- and ht.jylx = #{htlx}
- </if>
- <if test="cjkssj != null">
- and to_date(ht.cjrq,'yyyy-mm-dd') >= #{cjkssj}
- </if>
- <if test="cjjssj != null ">
- and to_date(ht.cjrq,'yyyy-mm-dd') <= #{cjjssj}
- </if>
- <if test="apcc != null ">
- and ht.apcc like '%'||#{apcc}||'%'
- </if>
- </where>
- order by r.create_date desc,r.htbm asc
- </select>
-
- <select id="selectContractList" resultType="com.unis.transaction.common.vo.tradeplan.RefundNoticeContractVO"
- parameterType="com.unis.transaction.common.vo.tradeplan.RefundNoticeQueryVO">
- SELECT
- <include refid="contractColumns" />,cc.jybzj,cc.lybzj,ht.htbm
- FROM ty_jyht ht
- LEFT JOIN ty_jycc cc on ht.ccbm = cc.ccbm
- <where>
- (ht.refund_status = 0 or ht.refund_status is null)
- <if test="htbm != null and htbm != ''">
- and ht.htbh like '%'||#{htbm}||'%'
- </if>
- <if test="cckmc != null and cckmc != ''">
- and ht.cckmc like '%'||#{cckmc}||'%'
- </if>
- <if test="kssj != null">
- and to_date(ht.prompt_date,'yyyy-mm-dd') >= #{kssj}
- </if>
- <if test="jssj != null ">
- and to_date(ht.prompt_date,'yyyy-mm-dd') <= #{jssj}
- </if>
- <if test="pzmc != null and pzmc != ''">
- and ht.pzmc like '%'||#{pzmc}||'%'
- </if>
- <if test="pzbm != null and pzbm != ''">
- and ht.pzbm = #{pzbm}
- </if>
- <if test="orgCode != null and orgCode != ''">
- and ht.fsdw like #{orgCode}||'%'
- </if>
- <if test="sgmc != null and sgmc != ''">
- and (instr(decode(ht.jylx, 0, ht.cmmc, 1, ht.sgmc), #{sgmc}) > 0)
- </if>
- <if test="cjkssj != null">
- and to_date(ht.cjrq,'yyyy-mm-dd') >= #{cjkssj}
- </if>
- <if test="cjjssj != null ">
- and to_date(ht.cjrq,'yyyy-mm-dd') <= #{cjjssj}
- </if>
- <if test="apcc != null ">
- and ht.apcc like '%'||#{apcc}||'%'
- </if>
- </where>
- order by ht.create_date desc
- </select>
-
- <update id="updateHtRefundStatusByHtbm">
- update ty_jyht
- set refund_status = #{refundStatus}
- where htbm = #{htbm}
- </update>
-
- <select id="selectByHtbm" resultType="com.unis.transaction.common.vo.tradeplan.RefundNoticeContractVO">
- SELECT
- <include refid="baseColumns" />,
- <include refid="contractColumns" />,cc.jybzj,cc.lybzj
- FROM ty_refund_notice r
- LEFT JOIN ty_jyht ht on r.htbm = ht.htbm
- LEFT JOIN ty_jycc cc on ht.ccbm = cc.ccbm
- <where>
- r.status = 1 and r.htbm = #{htbm}
-
- </where>
-
-
- </select>
-
- </mapper>
|