mybatis诡异的bug

在使用mybatis中使用 foreach 时,出现了一个诡异的bug

java文件中是

List<ImportTaskInfoEntity> selectByCalcBatchIds(@Param("ids") List<String> ids);

 

xml中是

<foreach collection="ids" index="index" item="item"
separator="or" open="(" close=")">
calc_batch_id = #{item}
</foreach>

 

按理,String直接取是ok,但是却取不到。查看异常为

Type handler was null on parameter mapping for property '__frch_item_0'. It was either not specified and/or could not be found for the javaType (com.xxx.sale.cmis.entity.AuditTaskEntity) : jdbcType (null) combination.

 

故猜测,mybatis将集合的元素转化成了 AuditTaskEntity ,故取值改成  calc_batch_id = #{item.calcBatchId} ,居然就通过了。

实在无解...................

posted @ 2018-03-06 21:00  kirkvicent  阅读(3167)  评论(3编辑  收藏  举报