mysql中replace into用法

<insert id="saveOrUpdatePayinfo" parameterType="com.bill.invoice.entity.BusBillPayinfo">
        replace into bus_bill_payinfo
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id!=null"> ID, </if>
            <if test="sysOrgCode!=null"> SYS_ORG_CODE, </if>
            <if test="billinfoid!=null"> BILLINFOID, </if>
            <if test="bankcode!=null"> BANKCODE, </if>
            <if test="billcode!=null"> BILLCODE, </if>
            <if test="trandamt!=null"> TRANDAMT, </if>
            <if test="tranddate!=null"> TRANDDATE, </if>
            <if test="returnamt!=null"> RETURNAMT, </if>
            <if test="returndate!=null"> RETURNDATE, </if>
            <if test="whendate!=null"> WHENDATE, </if>
            <if test="createBy!=null"> CREATE_BY, </if>
            <if test="createTime!=null"> CREATE_TIME, </if>
            <if test="updateBy!=null"> UPDATE_BY, </if>
            <if test="updateTime!=null"> UPDATE_TIME, </if>
        </trim>
        VALUES
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id!=null"> #{id}, </if>
            <if test="sysOrgCode!=null"> #{sysOrgCode}, </if>
            <if test="billinfoid!=null"> #{billinfoid}, </if>
            <if test="bankcode!=null">  #{bankcode}, </if>
            <if test="billcode!=null">  #{billcode}, </if>
            <if test="trandamt!=null">  #{trandamt}, </if>
            <if test="tranddate!=null">  #{tranddate}, </if>
            <if test="returnamt!=null">  #{returnamt}, </if>
            <if test="returndate!=null">  #{returndate}, </if>
            <if test="whendate!=null">  #{whendate}, </if>
            <if test="createBy!=null">  #{createBy}, </if>
            <if test="createTime!=null">  #{createTime}, </if>
            <if test="updateBy!=null">  #{updateBy}, </if>
            <if test="updateTime!=null">  #{updateTime}, </if>
        </trim>
    </insert>

 

posted @ 2022-06-26 18:22  花田007  阅读(31)  评论(0编辑  收藏  举报