<select >
        <foreach collection="map1" index="key" item="ent" separator="union">
            SELECT *
            FROM User
            where username=#{key}
            and userpass in
            <foreach collection="ent" item="id" separator="," open="(" close=")">
                #{id}
            </foreach>
        </foreach>

    </select>

 对应的mapper中是:

//map测试
List<User> selectMapTest(@Param("map1") Map<String,List<Integer>> ma1);


注意:foreach标签中的index就是map的key值

相关文章:

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