Mybatis mapper配置文件传入数组参数

Mybatis mapper配置文件传入数组参数
强烈推介IDEA2021.1.3破解激活,IntelliJ IDEA 注册码,2021.1.3IDEA 激活码  

大家好,我是架构君,一个会写代码吟诗的架构师。今天说一说Mybatis mapper配置文件传入数组参数,希望能够帮助大家进步!!!

<select id="yktestOrder" resultType="com.yuxun.fantuan.security.entity.User">
        select
        u.id,
        u.username
        FROM
        user u
        WHERE
        1 = 1
        <if test="null != ids and ids.size > 0">
        AND u.id IN
        <foreach item="item" index="index" collection="ids" open="(" separator="," close=")">
            #{item}
        </foreach>
            order by field(u.id,
            <foreach item="item" index="index" collection="ids" separator=",">
                #{item}
            </foreach>
            )
        </if>
    </select>

 

本文来源huayang183,由架构君转载发布,观点不代表Java架构师必看的立场,转载请标明来源出处:https://javajgs.com/archives/17937

发表评论