Type handler was null on parameter mapping for property '__frch_uid_0'
【IDEA 项目中,传参数 是 集合时 出现的问题。】
nested exception is org.apache.ibatis.exceptions.PersistenceException:
Error querying database. Cause: java.lang.IllegalStateException: Type handler was null on parameter mapping for property ‘__frch_uid_0’. It was either not specified and/or could not be found for the javaType / jdbcType combination specified.
Cause: java.lang.IllegalStateException: Type handler was null on parameter mapping for property ‘__frch_uid_0’. It was either not specified and/or could not be found for the javaType / jdbcType combination specified.
org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.exceptions.PersistenceException:
Error querying database. Cause: java.lang.IllegalStateException: Type handler was null on parameter mapping for property ‘__frch_uid_0’. It was either not specified and/or could not be found for the javaType / jdbcType combination specified.
————————————————
这个在 mapper 层 。
select * from table where id in
<foreach collection="yourList" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
1、你的这个 " yourList " 如果传递过来的是 对象的集合。例如:[“id”:"","":""],像这种 集合中有很多字段,你的mapper 中的 sql 不知道要使用哪个字段。
所以才会报你看不懂的错误日志。
那么,你应该获取的是 (item是自起的别名) item.id ,否则就报错 。 修改为 #{item.id}
2、或者,你直接把 id 查出来放到集合中 (保证其中只有一个相关字段)。那么就直接用了。所以不会报错 。
//普通
<if test="heiList!=null and heiList.size()!=0" >
and t.sales_code not in
<foreach collection="heiList" item="mid" index="index" open="(" separator="," close=")">