mybatis:如何在 mapper 的 bean 中迭代 hashmap?

mybatis: how to iterate a hashmap in a bean in mapper?

映射器接口:

List<Map<String, String>> selectXXXList(BeanA a);

BeanA:

private Map<String, String> map;

我需要在 xxxMapper.xml 中迭代此地图。这个方法我试过了,还是不行。

<select id = "selectXXXList" resultType="hashMap">
   SELECT * FROM tableA
   WHERE
      1=1 
      <foreach collection="a.map.keys" item="item" index="index" open="" seperator="" close="">
      AND ${item} = #{a.map[${item}]}
      </foreach>
<select>

这样可以迭代key。但是hashMap #{a.map[${item}]} 的值不起作用。任何的想法?顺便说一句,我无法更改界面。

试试这个:

<select id="selectXXXList" parameterType="beanA" resultType="hashmap">    
    select * from TABL where 
    <foreach  collection="map"  index="key" item="value"  open=""  separator=" and "  close="">
        ${key}=#{value}
    </foreach>
</select>