mybatis foreach where test用法

<select id="selectAny" resultType="user" parameterType="user">
        select id, name, age, gmt_create gmtCreate from users
        <where>
            <if test="ids!=null">
            and id in
                <foreach collection="ids" item="id" open="(" close=")" separator=",">
                    #{id}
                </foreach>
            </if>
        </where>
    </select>

 

posted on 2015-06-15 14:40  颓废的悠然  阅读(768)  评论(0编辑  收藏  举报

导航