org.apache.ibatis.builder.BuilderException: The expression 'list' evaluated to a null value
哈哈
阅读:1900
2021-03-31 16:53:40
评论:0
今天使用MyBatis3 编写批量更新接口提示如下错误信息:org.apache.ibatis.builder.BuilderException: The expression 'array' evaluated to a null value.
错误代码:
<if test="archSids != null">
and arch_sid in
<foreach collection="list" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
正确代码:
<if test="archSids != null">
and arch_sid in
<foreach collection="archSids" item="archSids" open="(" separator="," close=")">
#{archSids}
</foreach>
</if>
service 调用mapper 接口:
paramter.put("archSids", archSids);
List<Map<String, Long>> statistics = fileMapper.getStatistics(paramter);
结论:传参和接收参数不匹配,导致如上所述的错误信息
声明
1.本站遵循行业规范,任何转载的稿件都会明确标注作者和来源;2.本站的原创文章,请转载时务必注明文章作者和来源,不尊重原创的行为我们将追究责任;3.作者投稿可能会经我们编辑修改或补充。