mybatis传入List动态添加,主键存在则修改

    <insert id="insertData" parameterType="java.util.List">
        insert into app_database.app_user values  
        <foreach item="item" collection="list" separator="," index="index">
            (
            #{item.id},
            #{item.account},
            #{item.password},
            #{item.account_name},
            #{item.is_enable}
            )
        </foreach>
        ON DUPLICATE KEY UPDATE
        id = VALUES(id);
    </insert>

 

posted @ 2020-07-17 17:50  憨憨青年  阅读(408)  评论(0编辑  收藏  举报
// 侧边栏目录 // https://blog-static.cnblogs.com/files/douzujun/marvin.nav.my1502.css