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
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
SELECT
,
,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
r.lylx = #{lylx}
and (r.htbm like '%'||#{htbm}||'%' or ht.htbh like '%'||#{htbm}||'%')
and ht.cckmc like '%'||#{cckmc}||'%'
and to_date(ht.prompt_date,'yyyy-mm-dd') >= #{kssj}
and to_date(ht.prompt_date,'yyyy-mm-dd') <= #{jssj}
and ht.pzmc like '%'||#{pzmc}||'%'
and ht.pzbm = #{pzbm}
and r.zt = #{zt}
and ht.fsdw like #{orgCode}||'%'
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')))
and (instr(decode(ht.jylx, 0, ht.cmmc, 1, ht.sgmc), #{sgmc}) > 0)
and ht.jylx = #{htlx}
and to_date(ht.cjrq,'yyyy-mm-dd') >= #{cjkssj}
and to_date(ht.cjrq,'yyyy-mm-dd') <= #{cjjssj}
and ht.apcc like '%'||#{apcc}||'%'
order by r.create_date desc,r.htbm asc
SELECT
,cc.jybzj,cc.lybzj,ht.htbm
FROM ty_jyht ht
LEFT JOIN ty_jycc cc on ht.ccbm = cc.ccbm
(ht.refund_status = 0 or ht.refund_status is null)
and ht.htbh like '%'||#{htbm}||'%'
and ht.cckmc like '%'||#{cckmc}||'%'
and to_date(ht.prompt_date,'yyyy-mm-dd') >= #{kssj}
and to_date(ht.prompt_date,'yyyy-mm-dd') <= #{jssj}
and ht.pzmc like '%'||#{pzmc}||'%'
and ht.pzbm = #{pzbm}
and ht.fsdw like #{orgCode}||'%'
and (instr(decode(ht.jylx, 0, ht.cmmc, 1, ht.sgmc), #{sgmc}) > 0)
and to_date(ht.cjrq,'yyyy-mm-dd') >= #{cjkssj}
and to_date(ht.cjrq,'yyyy-mm-dd') <= #{cjjssj}
and ht.apcc like '%'||#{apcc}||'%'
order by ht.create_date desc
update ty_jyht
set refund_status = #{refundStatus}
where htbm = #{htbm}
SELECT
,
,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
r.status = 1 and r.htbm = #{htbm}