解決mybatis foreach 錯(cuò)誤: Parameter '__frch_item_0' not found
在遍歷對(duì)象的屬性(是ArrayList對(duì)象)時(shí)報(bào)錯(cuò):
org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.binding.BindingException: Parameter '__frch_item_0' not found. Available parameters are [1, 0, param1, param2]
在SQL語句中將#{} 改成 ${} 字符串類型然后加上引號(hào) '${item.name}'
<foreach collection="eventConditionList" index="index" item="item" separator="or" open="(" close=")">
(b.name = '${item.name}' and b.value = '${item.value}')
</foreach>