自学内容网 自学内容网

MyBatisPlus的Mapper.xml入参List执行in函数

使用情景

这个是开发过程中比较常见的情景,入参一个list,在Mapper.xml里面执行sql的in函数,今天来记录下这个问题,希望可以给大家一点帮助启发。

Mapper文件

解决方案

xml文件

 <select id="get" resultType="com.vo.tVo">
        SELECT
         name
        FROM
         user
        WHERE
        1 = 1
        AND is_del =0
        <if test="ids !=null ">
            AND id in
         <foreach item="id" collection="ids" open="(" separator="," close=")">
            #{id}
        </foreach>
        </if>
</select>

 


原文地址:https://blog.csdn.net/m0_73774439/article/details/140290511

免责声明:本站文章内容转载自网络资源,如本站内容侵犯了原著者的合法权益,可联系本站删除。更多内容请关注自学内容网(zxcms.com)!