• mybatis插入List<Map<String, String>>批量数据到Oracle数据库


    数据结构为List<Map<String, String>>,list中每个map为一条数据记录,需用mybatis将其插入到Oracle数据库。

    mapper接口

    public void insertEngineEBOMTemp(@Param("paramMapList")List<Map<String, ?>> jsonMapList);

    mapper.xml

    <insert id="insertEngineEBOMTemp" parameterType="list">
            begin
            <foreach collection="paramMapList" item="paramMap" separator="">
            INSERT into TT_ENGINE_EBOM_FROM_TC 
            (
                ENGINE_EBOM_TC_ID,
                ENGINE_TYPE,
                FUNCTION_MODULE,
                GROUP_ZU,
                PART_CODE,
                PART_NAME,
                PART_NAME_EN,
                VERSION,
                PART_NUM,
                SUBSTITUTE_LIST,
                PUBLISH_DATE,
                PART_PHASE,
                PART_IMPORTANCE_LEVEL,
                PART_RESPONSIBLE_PERSON,
                PART_USE_POSITION,
                REFERENCE_TIGHTENING_TORQUE,
                REMARK
            )
            VALUES
            (
                SEQ_TT_ENGINE_EBOM_TC_ID.nextval,
                #{paramMap.ENGINE_TYPE, jdbcType=VARCHAR},
                #{paramMap.FUNCTION_MODULE, jdbcType=VARCHAR},
                #{paramMap.GROUP_ZU, jdbcType=VARCHAR},
                #{paramMap.PART_CODE, jdbcType=VARCHAR},
                #{paramMap.PART_NAME, jdbcType=VARCHAR},
                #{paramMap.PART_NAME_EN, jdbcType=VARCHAR},
                #{paramMap.VERSION, jdbcType=VARCHAR},
                #{paramMap.PART_NUM, jdbcType=VARCHAR},
                #{paramMap.SUBSTITUTE_LIST, jdbcType=VARCHAR},
                #{paramMap.PUBLISH_DATE, jdbcType=VARCHAR},
                #{paramMap.PART_PHASE, jdbcType=VARCHAR},
                #{paramMap.PART_IMPORTANCE_LEVEL, jdbcType=VARCHAR},
                #{paramMap.PART_RESPONSIBLE_PERSON, jdbcType=VARCHAR},
                #{paramMap.PART_USE_POSITION, jdbcType=VARCHAR},
                #{paramMap.REFERENCE_TIGHTENING_TORQUE, jdbcType=VARCHAR},
                #{paramMap.REMARK, jdbcType=VARCHAR}
            );
            </foreach>
            commit;
            end;
        </insert>
  • 相关阅读:
    c# DateTime 格式化输出字符串
    计算运行时长
    ubuntu helpers
    json.net omit member
    git 本地项目关联新repo
    c# DirectoryEntry LDAPS
    为视图或函数指定的列名比其定义中的列多
    Java反序列化漏洞学习笔记
    流量抓包
    软件安全策略-下
  • 原文地址:https://www.cnblogs.com/alphajuns/p/12305228.html
Copyright © 2020-2023  润新知