MyBatis中对List<Object> 对象List的批处理插入操作

来源:互联网 发布:人工智能经济学 编辑:程序博客网 时间:2024/06/07 02:10

<insert id="insertAddressPosition" parameterType="java.util.List">
        <selectKey keyProperty="p1" order="BEFORE" resultType="int">
            select seq_app_addresslist.nextval from dual
        </selectKey>
        insert into appuser.ADDRESS_POSITION_BACKUP
        (row_id,pos_id,pos_name,create_date,update_date)
        <foreach collection="list" item="pop" separator="union all"
            open="(" close=")">
            select
            #{p1},#{pop.ROLE_ID,jdbcType=VARCHAR},#{pop.ROLE_NAME,jdbcType=VARCHAR},
            sysdate,sysdate
            from dual
        </foreach>
    </insert>

参照此篇文章 http://ask.csdn.net/questions/155651
这篇文章也不错 http://blog.csdn.net/moneyshi/article/details/22807239

阅读全文
0 0
原创粉丝点击