0
点赞
收藏
分享

微信扫一扫

Oracle批量操作

那小那小 2022-02-28 阅读 41

oracle 批量插入

    <insert id="insertStaffRoleByBatch">
        INSERT INTO
        SYS_STAFF_ROLE(ID,STAFF_CODE,ROLE_CODE,CREATOR_CODE,CREATED_TIME)
        <foreach collection="list" item="item" index="index" open="" close="" separator="union all">
            SELECT
            #{item.id,jdbcType=VARCHAR},
            #{item.staffCode,jdbcType=VARCHAR},
            #{item.roleCode,jdbcType=VARCHAR},
            #{item.creatorCode,jdbcType=VARCHAR},
            #{item.createdTime,jdbcType=DATE}
            from dual
        </foreach>
    </insert>

oracle批量更新

<update id="batchUpdateSplitSinglePickCurrency" parameterType="java.util.List">
        <foreach collection="list" item="item" index="index" open="begin" close=";end;" separator=";">
            UPDATE ZC_TR_MULTI_ORDER_CURRENCY
            <set>
                <if test="item.sysCorderCode != null">
                    SYS_CORDER_CODE = #{item.sysCorderCode,jdbcType=VARCHAR},
                </if>

                <if test="item.sysPorderCode != null">
                    SYS_PORDER_CODE = #{item.sysPorderCode,jdbcType=VARCHAR},
                </if>

                <if test="item.bizPorderCode != null">
                    BIZ_PORDER_CODE = #{item.bizPorderCode,jdbcType=VARCHAR},
                </if>

                <if test="item.originalOrderCode != null">
                    ORIGINAL_ORDER_CODE = #{item.originalOrderCode,jdbcType=VARCHAR},
                </if>

                <if test="item.splitUserId != null">
                    SPLIT_USER_ID = #{item.splitUserId,jdbcType=VARCHAR},
                </if>

                <if test="item.createDate != null">
                    CREATE_DATE = #{item.createDate},
                </if>

                <if test="item.updateDate != null">
                    UPDATE_DATE = #{item.updateDate},
                </if>
            </set>
            where id = #{item.id,jdbcType=VARCHAR}
        </foreach>
    </update>
举报

相关推荐

0 条评论