在映射器界面中我有:
ArrayList<Item> select(@Param("filterId")int filterId, @Param("filterData")HashMap<String,Object> filterData);
在映射器 xml 中我有:
<select id="select" parameterType="map" resultMap="RM">
SELECT ...
FROM ....
WHERE id=#{filterData["id"]}
</select>
没有错误,但结果不符合预期(它返回空集,但我知道存在具有此类 id 的项目)。 #{filterData["id"]} 似乎不起作用。我的错误在哪里?
最佳答案
我找到了答案:
<select id="select" parameterType="map" resultMap="RM">
SELECT ...
FROM ....
WHERE id=#{filterData.id}
</select>
关于java - HashMap 中的 MyBatis 参数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43600844/