<?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.brilliance.isc.mda.dao.InvuseMapper"> <resultMap id="BaseResultMap" type="com.brilliance.isc.bo.Invuse"> <result column="INR" property="inr" jdbcType="VARCHAR"/> <result column="seqnum" property="seqnum" jdbcType="VARCHAR"/> <result column="imfinr" property="imfinr" jdbcType="VARCHAR"/> <result column="sptinr" property="sptinr" jdbcType="VARCHAR"/> <result column="imgnum" property="imgnum" jdbcType="VARCHAR"/> <result column="imagid" property="imagid" jdbcType="VARCHAR"/> <result column="invtyp" property="invtyp" jdbcType="VARCHAR"/> <result column="invnum" property="invnum" jdbcType="VARCHAR"/> <result column="invcod" property="invcod" jdbcType="VARCHAR"/> <result column="untamt" property="untamt" jdbcType="DECIMAL"/> <result property="reason" column="reason" jdbcType="VARCHAR"/> <result column="invdat" property="invdat" jdbcType="DATE"/> <result column="checkcode" property="checkcode" jdbcType="VARCHAR"/> <result column="annotacode" property="annotacode" jdbcType="VARCHAR"/> <result column="annotaname" property="annotaname" jdbcType="VARCHAR"/> <result column="annotadate" property="annotadate" jdbcType="DATE"/> <result column="annotadesc" property="annotadesc" jdbcType="VARCHAR"/> <result column="amountin" property="amountin" jdbcType="DECIMAL"/> <result column="state" property="state" jdbcType="VARCHAR"/> <result column="isusedmsgid" property="isusedmsgid" jdbcType="VARCHAR"/> <result column="filtyp" property="filtyp" jdbcType="VARCHAR"/> <result column="filnam" property="filnam" jdbcType="VARCHAR"/> <result column="filguid" property="filguid" jdbcType="VARCHAR"/> <result column="filtext" property="filtext" jdbcType="VARCHAR"/> <result column="trninr" property="trninr" jdbcType="VARCHAR"/> <result column="ownref" property="ownref" jdbcType="VARCHAR"/> <result column="sndsta" property="sndsta" jdbcType="VARCHAR"/> <result column="msgid" property="msgid" jdbcType="VARCHAR"/> <result column="valflg" property="valflg" jdbcType="VARCHAR"/> <result column="isfnc" property="isfnc" jdbcType="VARCHAR"/> <result column="etyextkey" property="etyextkey" jdbcType="VARCHAR"/> <result column="invflg" property="invflg" jdbcType="VARCHAR"/> <result column="orgno" property="orgno" jdbcType="VARCHAR"/> <result column="amounttax" property="amounttax" jdbcType="DECIMAL"/> <result column="insidx" property="insidx" jdbcType="VARCHAR"/> <result column="branch" property="branch" jdbcType="VARCHAR"/> <result column="credat" property="credat" jdbcType="DATE"/> <result column="wsbatchnum" property="wsbatchnum" jdbcType="VARCHAR"/> <result column="skipped" property="skipped" jdbcType="CHAR"/> <result column="pntref" property="pntref" jdbcType="VARCHAR"/> <result property="hantyp" column="hantyp" jdbcType="VARCHAR"/> <result property="handat" column="handat" jdbcType="DATE"/> <result column="selfownref" property="selfownref" jdbcType="VARCHAR"/> </resultMap> <resultMap id="InvResultMap" type="com.brilliance.isc.common.invchk.vo.ImfResponseVo"> <result column="imfref" property="imfref" jdbcType="VARCHAR"/> <result column="ownref" property="ownref" jdbcType="VARCHAR"/> <result column="invcod" property="invcod" jdbcType="VARCHAR"/> <result column="invnum" property="invnum" jdbcType="VARCHAR"/> <result column="imfrefsta" property="imfrefsta" jdbcType="VARCHAR"/> <result column="credat" property="credat" jdbcType="DATE"/> <result property="salesname" column="salesname" jdbcType="VARCHAR"/> <result property="purchasername" column="purchasername" jdbcType="VARCHAR"/> <result column="ownusr" property="ownusr" jdbcType="VARCHAR"/> <result column="imfinr" property="imfinr" jdbcType="VARCHAR"/> </resultMap> <resultMap id="MonResultMap" type="com.brilliance.isc.common.invchk.vo.InvlstVo"> <result column="INR" property="inr" jdbcType="VARCHAR"/> <result column="seqnum" property="seqnum" jdbcType="VARCHAR"/> <result column="imfinr" property="imfinr" jdbcType="VARCHAR"/> <result column="sptinr" property="sptinr" jdbcType="VARCHAR"/> <result column="imgnum" property="imgnum" jdbcType="VARCHAR"/> <result column="imagid" property="imagid" jdbcType="VARCHAR"/> <result column="invtyp" property="invtyp" jdbcType="VARCHAR"/> <result column="invnum" property="invnum" jdbcType="VARCHAR"/> <result column="invcod" property="invcod" jdbcType="VARCHAR"/> <result column="untamt" property="untamt" jdbcType="DECIMAL"/> <result property="reason" column="reason" jdbcType="VARCHAR"/> <result column="invdat" property="invdat" jdbcType="DATE"/> <result column="checkcode" property="checkcode" jdbcType="VARCHAR"/> <result column="annotacode" property="annotacode" jdbcType="VARCHAR"/> <result column="annotaname" property="annotaname" jdbcType="VARCHAR"/> <result column="annotadate" property="annotadate" jdbcType="DATE"/> <result column="annotadesc" property="annotadesc" jdbcType="VARCHAR"/> <result column="amountin" property="amountin" jdbcType="DECIMAL"/> <result column="state" property="state" jdbcType="VARCHAR"/> <result column="isusedmsgid" property="isusedmsgid" jdbcType="VARCHAR"/> <result column="filtyp" property="filtyp" jdbcType="VARCHAR"/> <result column="filnam" property="filnam" jdbcType="VARCHAR"/> <result column="filguid" property="filguid" jdbcType="VARCHAR"/> <result column="filtext" property="filtext" jdbcType="VARCHAR"/> <result column="trninr" property="trninr" jdbcType="VARCHAR"/> <result column="ownref" property="ownref" jdbcType="VARCHAR"/> <result column="sndsta" property="sndsta" jdbcType="VARCHAR"/> <result column="msgid" property="msgid" jdbcType="VARCHAR"/> <result column="valflg" property="valflg" jdbcType="VARCHAR"/> <result column="isfnc" property="isfnc" jdbcType="VARCHAR"/> <result column="etyextkey" property="etyextkey" jdbcType="VARCHAR"/> <result column="invflg" property="invflg" jdbcType="VARCHAR"/> <result column="orgno" property="orgno" jdbcType="VARCHAR"/> <result column="amounttax" property="amounttax" jdbcType="DECIMAL"/> <result column="insidx" property="insidx" jdbcType="VARCHAR"/> <result column="branch" property="branch" jdbcType="VARCHAR"/> <result column="credat" property="credat" jdbcType="DATE"/> <result column="wsbatchnum" property="wsbatchnum" jdbcType="VARCHAR"/> <result column="skipped" property="skipped" jdbcType="CHAR"/> <result column="pntref" property="pntref" jdbcType="VARCHAR"/> <result column="regsta" property="regsta" jdbcType="VARCHAR"/> <result property="monstatus" column="monstatus" jdbcType="VARCHAR"/> <result property="checktotal" column="checktotal" jdbcType="VARCHAR"/> <result property="checkown" column="checkown" jdbcType="VARCHAR"/> <result property="checkother" column="checkother" jdbcType="VARCHAR"/> <result property="hantyp" column="hantyp" jdbcType="VARCHAR"/> <result property="handat" column="handat" jdbcType="DATE"/> <result column="selfownref" property="selfownref" jdbcType="VARCHAR"/> <result property="hanusr" column="hanusr" jdbcType="VARCHAR"/> <result property="salesname" column="salesname" jdbcType="VARCHAR"/> <result property="purchasername" column="purchasername" jdbcType="VARCHAR"/> <result property="balance" column="balance" jdbcType="DECIMAL"/> </resultMap> <sql id="Base_Column_List"> inr,seqnum,imfinr,sptinr,imgnum,imagid,invtyp,invnum,invcod,untamt, reason,invdat,checkcode,annotacode,annotaname,annotadate,annotadesc, amountin,state,isusedmsgid,filtyp,filnam,filguid,filtext,trninr,ownref, sndsta,msgid,valflg,isfnc,etyextkey,invflg,orgno,amounttax,insidx,branch, credat,wsbatchnum,skipped,pntref,hantyp,handat,selfownref </sql> <sql id="Mon_Column_List"> s.inr "inr",s.seqnum "seqnum",s.imfinr "imfinr",s.sptinr "sptinr",s.imgnum "imgnum",s.imagid "imagid",s.invtyp "invtyp",s.invnum "invnum",s.invcod "invcod",s.untamt "untamt", s.reason "reason",s.invdat "invdat",s.checkcode "checkcode",s.annotacode "annotacode",s.annotaname "annotaname",s.annotadate "annotadate",s.annotadesc "annotadesc", s.amountin "amountin",s.state "state",s.isusedmsgid "isusedmsgid",s.filtyp "filtyp",s.filnam "filnam",s.filguid "filguid",s.filtext "filtext",s.trninr "trninr",s.ownref "ownref", s.sndsta "sndsta",s.msgid "msgid",s.valflg "valflg",s.isfnc "isfnc",s.etyextkey "etyextkey",s.invflg "invflg",s.orgno "orgno",s.amounttax "amounttax",s.insidx "insidx",s.branch "branch", s.credat "credat",s.wsbatchnum "wsbatchnum",s.skipped "skipped",s.pntref "pntref",s.hantyp "hantyp",s.handat "handat",s.selfownref "selfownref",v.monstatus "monstatus",v.checktotal "checktotal",v.checkown "checkown",v.checkother "checkother", v.hanusr "hanusr",v.salesname "salesname",v.purchasername "purchasername",f.regsta "regsta",v.balance "balance" </sql> <select id="selectBySeqnum" resultMap="BaseResultMap"> select <include refid="Base_Column_List"/> from invuse where seqnum=#{seqnum} </select> <select id="selectByCodeNum" resultMap="BaseResultMap"> select <include refid="Base_Column_List"/> from invuse where invcod=#{invcod} and invnum=#{invnum} and pntref is not null and pntref !='' and valflg='VLID' </select> <select id="selectByCodeNumSeqnum" resultMap="BaseResultMap"> select <include refid="Base_Column_List"/> from invuse where invcod=#{invcod} and invnum=#{invnum} and seqnum=#{seqnum} </select> <insert id="insert"> insert into invuse (<include refid="Base_Column_List" />) <trim prefix="values (" suffix=")" suffixOverrides=","> #{inr}, #{seqnum}, #{imfinr}, #{sptinr}, #{imgnum}, #{imagid}, #{invtyp}, #{invnum}, #{invcod}, #{untamt,jdbcType=DECIMAL}, #{reason}, #{invdat,jdbcType=DATE}, #{checkcode}, #{annotacode}, #{annotaname}, #{annotadate,jdbcType=DATE}, #{annotadesc}, #{amountin,jdbcType=DECIMAL}, #{state}, #{isusedmsgid}, #{filtyp}, #{filnam}, #{filguid}, #{filtext}, #{trninr}, #{ownref}, #{sndsta}, #{msgid}, #{valflg}, #{isfnc}, #{etyextkey}, #{invflg}, #{orgno}, #{amounttax,jdbcType=DECIMAL}, #{insidx}, #{branch}, #{credat,jdbcType=DATE}, #{wsbatchnum}, #{skipped}, #{pntref}, #{hantyp}, #{handat}, #{selfownref}, </trim> </insert> <insert id="insertSelective"> insert into invuse <trim prefix="(" suffix=")" suffixOverrides=","> <if test="inr != null">inr,</if> <if test="seqnum != null">seqnum,</if> <if test="imfinr != null">imfinr,</if> <if test="sptinr != null">sptinr,</if> <if test="imgnum != null">imgnum,</if> <if test="imagid != null">imagid,</if> <if test="invtyp != null">invtyp,</if> <if test="invnum != null">invnum,</if> <if test="invcod != null">invcod,</if> <if test="untamt != null">untamt,</if> <if test="reason != null">reason,</if> <if test="invdat != null">invdat,</if> <if test="checkcode != null">checkcode,</if> <if test="annotacode != null">annotacode,</if> <if test="annotaname != null">annotaname,</if> <if test="annotadate != null">annotadate,</if> <if test="annotadesc != null">annotadesc,</if> <if test="amountin != null">amountin,</if> <if test="state != null">state,</if> <if test="isusedmsgid != null">isusedmsgid,</if> <if test="filtyp != null">filtyp,</if> <if test="filnam != null">filnam,</if> <if test="filguid != null">filguid,</if> <if test="filtext != null">filtext,</if> <if test="trninr != null">trninr,</if> <if test="ownref != null">ownref,</if> <if test="sndsta != null">sndsta,</if> <if test="msgid != null">msgid,</if> <if test="valflg != null">valflg,</if> <if test="isfnc != null">isfnc,</if> <if test="etyextkey != null">etyextkey,</if> <if test="invflg != null">invflg,</if> <if test="orgno != null">orgno,</if> <if test="amounttax != null">amounttax,</if> <if test="insidx != null">insidx,</if> <if test="branch != null">branch,</if> <if test="credat != null">credat,</if> <if test="wsbatchnum != null">wsbatchnum,</if> <if test="skipped != null">skipped,</if> <if test="pntref != null">pntref,</if> <if test="hantyp != null">hantyp,</if> <if test="handat != null">handat,</if> <if test="selfownref != null">selfownref,</if> </trim> <trim prefix="values (" suffix=")" suffixOverrides=","> <if test="inr != null">#{inr},</if> <if test="seqnum != null">#{seqnum},</if> <if test="imfinr != null">#{imfinr},</if> <if test="sptinr != null">#{sptinr},</if> <if test="imgnum != null">#{imgnum},</if> <if test="imagid != null">#{imagid},</if> <if test="invtyp != null">#{invtyp},</if> <if test="invnum != null">#{invnum},</if> <if test="invcod != null">#{invcod},</if> <if test="untamt != null">#{untamt,jdbcType=DECIMAL},</if> <if test="reason != null">#{reason},</if> <if test="invdat != null">#{invdat,jdbcType=DATE},</if> <if test="checkcode != null">#{checkcode},</if> <if test="annotacode != null">#{annotacode},</if> <if test="annotaname != null">#{annotaname},</if> <if test="annotadate != null">#{annotadate,jdbcType=DATE},</if> <if test="annotadesc != null">#{annotadesc},</if> <if test="amountin != null">#{amountin,jdbcType=DECIMAL},</if> <if test="state != null">#{state},</if> <if test="isusedmsgid != null">#{isusedmsgid},</if> <if test="filtyp != null">#{filtyp},</if> <if test="filnam != null">#{filnam},</if> <if test="filguid != null">#{filguid},</if> <if test="filtext != null">#{filtext},</if> <if test="trninr != null">#{trninr},</if> <if test="ownref != null">#{ownref},</if> <if test="sndsta != null">#{sndsta},</if> <if test="msgid != null">#{msgid},</if> <if test="valflg != null">#{valflg},</if> <if test="isfnc != null">#{isfnc},</if> <if test="etyextkey != null">#{etyextkey},</if> <if test="invflg != null">#{invflg},</if> <if test="orgno != null">#{orgno},</if> <if test="amounttax != null">#{amounttax,jdbcType=DECIMAL},</if> <if test="insidx != null">#{insidx},</if> <if test="branch != null">#{branch},</if> <if test="credat != null">#{credat,jdbcType=DATE},</if> <if test="wsbatchnum != null">#{wsbatchnum},</if> <if test="skipped != null">#{skipped},</if> <if test="pntref != null">#{pntref},</if> <if test="hantyp != null">#{hantyp},</if> <if test="handat != null">#{handat},</if> <if test="selfownref != null">#{selfownref},</if> </trim> </insert> <select id="selectByCodeNumSeqnumForUpdate" resultMap="BaseResultMap"> select <include refid="Base_Column_List"/> from invuse where invcod=#{invcod} and invnum=#{invnum} and seqnum=#{seqnum} for update </select> <update id="updateByPrimaryKey"> update invuse <set> seqnum = #{seqnum}, imfinr = #{imfinr}, sptinr = #{sptinr}, imgnum = #{imgnum}, imagid = #{imagid}, invtyp = #{invtyp}, invnum = #{invnum}, invcod = #{invcod}, untamt = #{untamt,jdbcType=DECIMAL}, reason = #{reason}, invdat = #{invdat,jdbcType=DATE}, checkcode = #{checkcode}, annotacode = #{annotacode}, annotaname = #{annotaname}, annotadate = #{annotadate,jdbcType=DATE}, annotadesc = #{annotadesc}, amountin = #{amountin,jdbcType=DECIMAL}, state = #{state}, isusedmsgid = #{isusedmsgid}, filtyp = #{filtyp}, filnam = #{filnam}, filguid = #{filguid}, filtext = #{filtext}, trninr = #{trninr}, ownref = #{ownref}, sndsta = #{sndsta}, msgid = #{msgid}, valflg = #{valflg}, isfnc = #{isfnc}, etyextkey = #{etyextkey}, invflg = #{invflg}, orgno = #{orgno}, amounttax = #{amounttax,jdbcType=DECIMAL}, insidx = #{insidx}, branch = #{branch}, credat = #{credat,jdbcType=DATE}, wsbatchnum = #{wsbatchnum}, skipped = #{skipped}, pntref = #{pntref}, hantyp = #{hantyp}, handat = #{handat}, selfownref = #{selfownref}, </set> where inr = #{inr} </update> <delete id="deleteByCondition"> delete from invuse where inr = #{inr} and (sptinr is null or trim(sptinr) = '') and (imfinr is null or trim(imfinr) = '') </delete> <delete id="deleteByPrimaryKey"> delete from invuse where inr = #{inr} </delete> <delete id="deleteBySeqnum"> delete from invuse where seqnum = #{seqnum} and (sptinr is null or trim(sptinr) ='') and (imfinr is null or trim(imfinr) ='') </delete> <delete id="deleteByListSeqnum"> delete from invuse where seqnum = #{seqnum} </delete> <select id="selectByPrimaryKey" resultMap="BaseResultMap"> select <include refid="Base_Column_List"/> from invuse where inr = #{inr} </select> <select id="getInvlistBySmhInr" resultMap="BaseResultMap"> select <include refid="Base_Column_List"/> from invuse where smhinr = #{smhinr} </select> <select id="getInvlistForupdate" resultMap="BaseResultMap"> select SEQNUM, orgno ,INVCOD ,INVNUM ,date_format(INVDAT ,'%Y-%m-%d') INVDAT ,CHECKCODE,replace(format(UNTAMT,2),',','') as UNTAMT,replace(format(AMOUNTTAX,2),',','') as AMOUNTTAX from invuse where wsbatchnum != 'NONE' and STATE != '0' </select> <select id="selectInvByIsusedmsgidAndInsidx" resultMap="BaseResultMap"> select <include refid="Base_Column_List"/> from invuse where isusedmsgid = #{isusedmsgid} and insidx = #{insidx} </select> <update id="updateInvuseByIsusedmsgidAndInsidx"> update invuse <set> seqnum = #{seqnum}, imfinr = #{imfinr}, sptinr = #{sptinr}, imgnum = #{imgnum}, imagid = #{imagid}, invtyp = #{invtyp}, invnum = #{invnum}, invcod = #{invcod}, untamt = #{untamt,jdbcType=DECIMAL}, reason = #{reason}, invdat = #{invdat,jdbcType=DATE}, checkcode = #{checkcode}, annotacode = #{annotacode}, annotaname = #{annotaname}, annotadate = #{annotadate,jdbcType=DATE}, annotadesc = #{annotadesc}, amountin = #{amountin,jdbcType=DECIMAL}, state = #{state}, isusedmsgid = #{isusedmsgid}, filtyp = #{filtyp}, filnam = #{filnam}, filguid = #{filguid}, filtext = #{filtext}, trninr = #{trninr}, ownref = #{ownref}, sndsta = #{sndsta}, msgid = #{msgid}, valflg = #{valflg}, isfnc = #{isfnc}, etyextkey = #{etyextkey}, invflg = #{invflg}, orgno = #{orgno}, amounttax = #{amounttax,jdbcType=DECIMAL}, insidx = #{insidx}, branch = #{branch}, credat = #{credat,jdbcType=DATE}, wsbatchnum = #{wsbatchnum}, skipped = #{skipped}, pntref = #{pntref}, hantyp = #{hantyp}, handat = #{handat}, selfownref = #{selfownref}, </set> where isusedmsgid = #{isusedmsgid,jdbcType=DECIMAL} and insidx = #{insidx,jdbcType=DECIMAL} </update> <update id="updateByCodeNumSeqnum"> update invuse <set> <if test="invtyp != null">invtyp = #{invtyp},</if> <if test="invdat != null">invdat = #{invdat,jdbcType=DATE},</if> reason = #{reason}, <if test="checkcode != null">checkcode = #{checkcode},</if> <if test="invcod != null">invcod = #{invcod},</if> <if test="invnum != null">invnum = #{invnum},</if> <if test="seqnum != null">seqnum = #{seqnum},</if> state = #{state}, </set> where invcod = #{invcod} and invnum = #{invnum} and seqnum = #{seqnum} </update> <select id="selectByImgnum" resultMap="BaseResultMap"> select <include refid="Base_Column_List"/> from invuse where imgnum = #{imgnum} </select> <select id="selectByInvuseQueryVo" resultType="com.brilliance.isc.vo.InvuseResponeVo"> select s.*,bch.bchname bchname,i.MONSTATUS ,i.RISKDESCRIPTION,i.RISKCREATIONTIME,i.MONSTATUSTIME,i.SALESNAME, i.PURCHASERNAME, i.CHECKTOTAL,i.PURCHASERTAXNO, i.SALESTAXNO, i.TOTALAMOUNT, i.REMARKS, i.CHECKOWN, i.MONITORTOAL, i.MONITOROWN, case when trn.objtyp in('BDD','BFD','BPD') then '01' when trn.objtyp='CPD' then '02' end as yewulx from invuse s inner join trn trn on trn.inr=s.trninr left join bch bch on bch.branch = s.branch left join inv i on s.INVCOD = i.INVOICECODE and s.INVNUM = i.INVOICENUMBER where 1 = 1 and s.valflg='VLID' <!--机构隔离--> <if test="branch != '1000' and bchLst != null and bchLst.size() >0 "> and s.branch in <foreach item="bch" collection="bchLst" open="(" separator="," close=")"> #{bch.branch} </foreach> </if> <if test="opndatfrom != null and opndatfrom != ''"> and i.monstatustime >= #{opndatfrom} </if> <if test="opndatto != null and opndatto != ''"> and i.monstatustime <= #{opndatto} </if> <if test="seaownref != null and seaownref != ''"> and s.ownref = #{seaownref} </if> <if test="seaownref == null or seaownref == ''"> and s.ownref is not null and s.ownref !='' </if> <if test="pntref != null and pntref != ''"> and s.pntref = #{pntref} </if> <if test="invoicecode != null and invoicecode != ''"> and s.invcod = #{invoicecode} </if> <if test="invoicenumber != null and invoicenumber != ''"> and s.invnum = #{invoicenumber} </if> <if test='monstatus == "Y"'> and i.monstatus in ('0','1','2','5','6','7') </if> <if test='monstatus != null and monstatus != "" and monstatus != "Y"'> and i.monstatus = #{monstatus} </if> <if test='hantyp == "D"'> and (s.hantyp is null or s.hantyp='C' or (s.hantyp='B' and s.handat <= i.riskcreationtime)) </if> <if test='hantyp != null and hantyp != "" and hantyp != "D"'> and s.hantyp=#{hantyp} </if> <if test='yewulx == "01"'> and trn.objtyp in('BDD','BFD','BPD') </if> <if test='yewulx == "02"'> and trn.objtyp='CPD' </if> <if test='column != null and column!="" '> order by s.${column} ${order} </if> <if test='column == null or column=="" '> order by s.invdat desc </if> </select> <select id="selectBySeqnumStateReason" resultMap="BaseResultMap"> select <include refid="Base_Column_List"/> from invuse where seqnum = #{seqnum} and STATE is null and REASON is null </select> <select id="selectByOwnrefAndCodAndNum" resultMap="BaseResultMap"> select <include refid="Base_Column_List"/> from invuse where ownref = #{ownref} and invcod=#{invcod} and invnum=#{invnum} and valflg='VLID' </select> <delete id="deleteBySeqnumStateReason"> delete from invuse where seqnum = #{seqnum} and (sptinr is null or trim(sptinr) ='') and (imfinr is null or trim(imfinr) ='') and STATE is null and REASON is null </delete> <select id="getInvList" resultMap="BaseResultMap"> select <include refid="Base_Column_List"/> from invuse where 1=1 and branch like concat('%', #{branch}, '%') <if test="invcod != null and invcod !='' and invcod !='null' "> and invcod like concat('%', #{invcod}, '%') </if> <if test="invnum != null and invnum !='' and invnum !='null'"> and invnum like concat('%', #{invnum}, '%') </if> <!-- <if test="prebnkdat != null">--> <!-- and annotadate >= #{prebnkdat}--> <!-- </if>--> <!-- <if test="prebnkdat2 != null">--> <!-- and annotadate <= #{prebnkdat2}--> <!-- </if>--> order by inr desc </select> <select id="selectBalanceByCondition" resultMap="BaseResultMap"> select <include refid="Base_Column_List"/> from invuse where invcod=#{invcod} and invnum=#{invnum} and valflg='VLID' and ownref like concat('%','JD', '%') </select> <select id="selectByOwnrefStateReason" resultMap="BaseResultMap"> select <include refid="Base_Column_List"/> from invuse where ownref=#{ownref} and state is null and reason is null </select> <select id="selectByImgnumList" resultMap="BaseResultMap"> select <include refid="Base_Column_List"/> from invuse where imgnum in <foreach item="item" index="index" collection="imgnumList" open="(" separator="," close=")"> #{item} </foreach> </select> <select id="selectInvByCondition" resultMap="InvResultMap"> select f.ownref "imfref",f.subref "ownref",s.invcod "invcod",s.invnum "invnum",f.imfrefsta "imfrefsta",f.credat "credat",v.salesname "salesname",v.purchasername "purchasername",f.ownusr "ownusr",f.inr "imfinr" from imf f left join invuse s on s.imfinr = f.inr left join inv v on s.invnum = v.invoicenumber and s.invcod = v.invoicecode where 1=1 and f.usrbch like concat('%', #{branch}, '%') <if test="imfref != null and imfref !=''"> and f.ownref like concat('%', #{imfref}, '%') </if> <if test="ownref != null and ownref !=''"> and f.subref like concat('%', #{ownref}, '%') </if> <if test="invcod != null and invcod !=''"> and s.invcod like concat('%', #{invcod}, '%') </if> <if test="invnum != null and invnum !=''"> and s.invnum like concat('%', #{invnum}, '%') </if> <if test="imfrefsta != null and imfrefsta !=''"> and f.imfrefsta = #{imfrefsta} </if> <if test="opndatfrom != null"> and f.credat >= #{opndatfrom} </if> <if test="opndatto != null"> and f.credat <= #{opndatto} </if> group by f.ownref order by f.inr desc,f.credat desc </select> <select id="selectByOwnrefSkipped" resultMap="MonResultMap"> select <include refid="Mon_Column_List"/> from invuse s left join inv v on s.invnum = v.invoicenumber and s.invcod = v.invoicecode left join imfinv f on s.invnum = f.invnum and s.invcod = f.invcod and s.branch = f.optbranch where s.ownref=#{ownref} and s.skipped = 'X' </select> <select id="selectByOwnrefMonstatus" resultMap="MonResultMap"> select <include refid="Mon_Column_List"/> from invuse s left join inv v on s.invnum = v.invoicenumber and s.invcod = v.invoicecode left join imfinv f on s.invnum = f.invnum and s.invcod = f.invcod and s.branch = f.optbranch where s.ownref=#{ownref} and v.monstatus in ('0','1','2','5','6','7','X') and s.valflg='VLID' <if test='ignflg == "X"'> and (trim(s.hantyp) is null or s.hantyp='C' or s.hantyp='B') </if> <if test='ignflg == ""'> and (trim(s.hantyp) is null or s.hantyp='C' or (s.hantyp='B' and s.handat <= v.riskcreationtime)) </if> </select> <select id="selectByImfinr" resultMap="MonResultMap"> select <include refid="Mon_Column_List"/> from invuse s left join inv v on s.invnum = v.invoicenumber and s.invcod = v.invoicecode left join imfinv f on s.invnum = f.invnum and s.invcod = f.invcod and s.branch = f.optbranch where s.imfinr=#{imfinr} and s.valflg='VLID' </select> <select id="selectBySptinr" resultMap="MonResultMap"> select <include refid="Mon_Column_List"/> from invuse s left join inv v on s.invnum = v.invoicenumber and s.invcod = v.invoicecode left join imfinv f on s.invnum = f.invnum and s.invcod = f.invcod and s.branch = f.optbranch where s.valflg='VLID' and (s.ownref=#{ownref} and s.skipped = 'X' <if test="sptinr != null and sptinr !=''"> or s.sptinr = #{sptinr} </if> ) </select> <select id="selectByOwnref" resultMap="MonResultMap"> select <include refid="Mon_Column_List"/> from invuse s left join inv v on s.invnum = v.invoicenumber and s.invcod = v.invoicecode left join imfinv f on s.invnum = f.invnum and s.invcod = f.invcod and s.branch = f.optbranch where s.ownref=#{ownref} and s.valflg='VLID' and (s.skipped = '' or s.skipped is null) </select> <select id="selectInvuseByOwnrefSkipped" resultMap="BaseResultMap"> select <include refid="Base_Column_List"/> from invuse where ownref=#{ownref} and valflg='VLID' and (skipped = '' or skipped is null) group by invcod,invnum </select> <select id="selectImfinvBySeqnum" resultMap="MonResultMap"> select <include refid="Mon_Column_List"/> from invuse s left join inv v on s.invnum = v.invoicenumber and s.invcod = v.invoicecode left join imfinv f on s.invnum = f.invnum and s.invcod = f.invcod and s.branch = f.optbranch where s.seqnum=#{seqnum} </select> <select id="selectInvuseByImfinr" resultMap="BaseResultMap"> select <include refid="Base_Column_List"/> from invuse where imfinr=#{imfinr} </select> <update id="updateOwnrefByImfinr"> update invuse <set> ownref = #{ownref} </set> where imfinr = #{imfinr} </update> <select id="selectImfinvByInr" resultMap="MonResultMap"> select <include refid="Mon_Column_List"/> from invuse s left join inv v on s.invnum = v.invoicenumber and s.invcod = v.invoicecode left join imfinv f on s.invnum = f.invnum and s.invcod = f.invcod and s.branch = f.optbranch where s.inr=#{inr} </select> <select id="selectByInr" resultMap="MonResultMap"> select <include refid="Mon_Column_List"/> from invuse s left join inv v on s.invnum = v.invoicenumber and s.invcod = v.invoicecode left join imfinv f on s.invnum = f.invnum and s.invcod = f.invcod and s.branch = f.optbranch where s.inr=#{inr} and s.valflg='VLID' </select> <update id="updateStateBySeqnum"> update invuse set state='0',invtyp='ECOM',checkcode='123456' where seqnum = #{seqnum} </update> <select id="selectByImgnumAndFilenam" resultMap="BaseResultMap"> select <include refid="Base_Column_List"/> from invuse where imgnum = #{imgnum} and filnam = #{filnam} </select> <delete id="deleteByImgnumAndFilenam"> delete from invuse where imgnum = #{imgnum} and filnam = #{filnam} </delete> <select id="selectByBfdOwnref" resultMap="MonResultMap"> select <include refid="Mon_Column_List"/> from invuse s left join inv v on s.invnum = v.invoicenumber and s.invcod = v.invoicecode left join imfinv f on s.invnum = f.invnum and s.invcod = f.invcod and s.branch = f.optbranch where s.ownref=#{ownref} and s.valflg='VLID' </select> <select id="selectByImgnumFilenam" resultMap="BaseResultMap"> select <include refid="Base_Column_List"/> from invuse where imgnum = #{imgnum} and filnam = #{filnam} </select> <select id="selectMonResultByImgnumList" resultMap="MonResultMap"> select <include refid="Mon_Column_List"/> from invuse s left join inv v on s.invnum = v.invoicenumber and s.invcod = v.invoicecode left join imfinv f on s.invnum = f.invnum and s.invcod = f.invcod and s.branch = f.optbranch where s.imgnum in <foreach item="item" index="index" collection="imgnumList" open="(" separator="," close=")"> #{item} </foreach> </select> <delete id="deleteByInrList"> delete from invuse where inr in <foreach item="item" index="index" collection="inrList" open="(" separator="," close=")"> #{item} </foreach> </delete> <update id="updateByInrList"> update invuse set pntref='',ownref='',trninr='' where inr in <foreach item="item" index="index" collection="inrList" open="(" separator="," close=")"> #{item} </foreach> </update> <select id="getAbnormalInvCount" resultType="int"> select count(1) from invuse s left join inv v on s.invnum = v.invoicenumber and s.invcod = v.invoicecode where s.ownref is not null and s.ownref !='' and s.valflg='VLID' <if test="branch != null and branch != '' and branch != '1000'"> and s.branch=#{branch} </if> and v.monstatus in ('0','1','2','5','6','7') and (trim(s.hantyp) is null or s.hantyp='C' or (s.hantyp='B' and s.handat <= v.riskcreationtime)) </select> <select id="selectByownrefAndvalflg" resultType="java.lang.String"> select invnum from invuse where ownref = #{ownref} and valflg='VLID' order by inr asc </select> <select id="selectInvuseByOwnref" resultMap="BaseResultMap"> select <include refid="Base_Column_List"/> from invuse where ownref=#{ownref} and valflg='VLID' </select> <select id="selectInvuseByBfdOwnref" resultMap="BaseResultMap"> select <include refid="Base_Column_List"/> from invuse where ownref=#{ownref} and valflg='VLID' </select> <update id="updateSelfByInrList"> update invuse set selfownref="self" where inr in <foreach item="item" index="index" collection="inrList" open="(" separator="," close=")"> #{item} </foreach> </update> <select id="selectBySelfownref" resultMap="MonResultMap"> select <include refid="Mon_Column_List"/> from invuse s left join inv v on s.invnum = v.invoicenumber and s.invcod = v.invoicecode left join imfinv f on s.invnum = f.invnum and s.invcod = f.invcod and s.branch = f.optbranch where s.valflg='VLID' and s.selfownref=#{selfownref} and s.skipped = 'X' </select> <select id="selectBySelfSkip" resultMap="MonResultMap"> select <include refid="Mon_Column_List"/> from invuse s left join inv v on s.invnum = v.invoicenumber and s.invcod = v.invoicecode left join imfinv f on s.invnum = f.invnum and s.invcod = f.invcod and s.branch = f.optbranch where s.valflg='VLID' and s.selfownref=#{selfownref} and (s.skipped = '' or s.skipped is null) </select> <select id="selectInvlstByOwnref" resultMap="MonResultMap"> select <include refid="Mon_Column_List"/> from invuse s left join inv v on s.invnum = v.invoicenumber and s.invcod = v.invoicecode left join imfinv f on s.invnum = f.invnum and s.invcod = f.invcod and s.branch = f.optbranch where s.valflg='VLID' and s.ownref=#{ownref} </select> <select id="selectInvlsBySelfownref" resultMap="MonResultMap"> select <include refid="Mon_Column_List"/> from invuse s left join inv v on s.invnum = v.invoicenumber and s.invcod = v.invoicecode left join imfinv f on s.invnum = f.invnum and s.invcod = f.invcod and s.branch = f.optbranch where s.valflg='VLID' and s.selfownref=#{selfownref} </select> <select id="getAbnormalInvByOwnref" resultMap="BaseResultMap"> select s.* from invuse s left join inv v on s.invnum = v.invoicenumber and s.invcod = v.invoicecode where s.ownref =#{ownref} and s.valflg='VLID' and v.monstatus in ('0','1','2','5','6','7') and (trim(s.hantyp) is null or s.hantyp='C' or (s.hantyp='B' and s.handat <= v.riskcreationtime)) </select> <select id="selectByPntref" resultType="com.brilliance.isc.common.invchk.vo.InvlstVo"> select <include refid="Mon_Column_List"/> from invuse s left join inv v on s.invnum = v.invoicenumber and s.invcod = v.invoicecode left join imfinv f on s.invnum = f.invnum and s.invcod = f.invcod and s.branch = f.optbranch where s.PNTREF=#{ownref} and s.valflg='VLID' </select> <select id="selectByInrList" resultMap="MonResultMap"> select <include refid="Mon_Column_List"/> from invuse s left join inv v on s.invnum = v.invoicenumber and s.invcod = v.invoicecode left join imfinv f on s.invnum = f.invnum and s.invcod = f.invcod and s.branch = f.optbranch where s.inr in <foreach item="item" index="index" collection="inrList" open="(" separator="," close=")"> #{item} </foreach> </select> <delete id="deleteByImgnum"> delete from invuse where imgnum = #{imgnum} </delete> </mapper>