org.apache.ibatis.builder.BuilderException: The expression 'list' evaluated to a null value

今天使用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);

结论:传参和接收参数不匹配,导致如上所述的错误信息

发布了1266 篇原创文章 · 获赞 275 · 访问量 290万+

猜你喜欢

转载自blog.csdn.net/zhouzhiwengang/article/details/103688322