参考:

​https://www.jianshu.com/p/06672a2d6ca4​

 

参考代码:

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

 

实现代码:

把文件里的内容按行读取,然后以行为单位进行 select in 查询

mybatis-plus @Select select in 查询实现_javascript

 

 

 

 

mybatis-plus @Select select in 查询实现_javascript_02