mybatis实现自定义SQL并且请求参数是集合

1Java文件

List<RFMenu> getMenusByIds(@Param(value="ids")List<Integer> ids);

2.对应的xml文件

<select id="getMenusByIds" parameterType="java.lang.Integer" resultType="com.ruifeng.tjtaxiwebqy.entity.RFMenu">
    SELECT Lsh,Lb,MenuCaption,MenuBrief,MenuKey,ParentMenuKey,ICON,isShow,Ord
    from RFMenu WHERE isShow='1'
    <if test="ids != null">
        AND Lsh in
        <foreach collection="ids" open="(" separator="," close=")" item="id">
            #{id}
        </foreach>
    </if>
    ORDER BY  Ord ,ParentMenuKey
</select>

 


版权声明:本文为iamlzyoco原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。