Parameter 'orderGuid' not found. Available parameters are [collection, list]

在批量插入的时候报的这个错。

原因是:

<insert id="batchInsert" parameterType="com.test.Serial"
        useGeneratedKeys="true" keyProperty="id" keyColumn="id">
    insert into stock_serial (<include refid="all_sql_columns_fields"/>) values
    <foreach item="item" collection="list" separator=",">
        (#{item.id,jdbcType=BIGINT},#{item.yn,jdbcType=INTEGER},
        #{item.version,jdbcType=INTEGER},#{orderGuid,jdbcType=VARCHAR})
    </foreach>
</insert>

这是一个动态SQL,通过循环构造批量插入的语句。

orderGuid的取值应该是#{item.orderGuid, jdbcType=VARCHAR}

少了一个"item."。

发布了57 篇原创文章 · 获赞 39 · 访问量 20万+

猜你喜欢

转载自blog.csdn.net/SJZYLC/article/details/100085827