mybatis XML中 遍历map写法

 <select parameterType="java.util.HashMap" resultMap="BaseResultMap">

        <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>

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/zggffy.html