数据结构为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>