在使用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} ,居然就通过了。

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

相关文章:

  • 2022-03-05
  • 2021-12-05
  • 2022-12-23
  • 2022-02-23
  • 2021-07-15
  • 2021-12-12
  • 2022-12-23
  • 2021-07-22
猜你喜欢
  • 2021-12-02
  • 2022-12-23
  • 2021-08-06
  • 2021-10-27
  • 2021-07-13
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案