oracle和mybatis整合,批次插入

信铁寒胜發表於2024-11-05

1、如下

<insert id="insertUsers" parameterType="java.util.List">
        INSERT ALL
        <foreach collection="list" item="user">
            INTO pms_user
            (
                userId,
                username,
                passwordHash
            )
            VALUES
            (
                #{user.userId, jdbcType=VARCHAR},
                #{user.username, jdbcType=VARCHAR},
                #{user.passwordHash, jdbcType=VARCHAR}
            )
        </foreach>
        SELECT * FROM dual
    </insert>

  

相關文章