【Java】Mybatis实现in查询

286 阅读1分钟

例:如下为in查询user表,uidList如 [1,2,3]

  <select id="selectUserInUid" resultType="com.ygxk.lws.modules.user.entity.UserEntity">
    select * from user
    where uid in
    <foreach collection="uidList" item="uidList" index="index" open="(" close=")" separator=",">
      #{uidList}
    </foreach>
  </select>