mybatis如何根据多个id进行查询

mybatis如何根据多个id进行查询

  根据多个id进行查询的示例代码如下所示:

Page<UserPoJo> getUserListByIds(@Param("ids") List<Integer> ids);

<!--根据id列表批量查询user-->
<select id="getUserListByIds" resultType="com.guor.UserPoJo">
select * from student
where id in
<foreach collection="ids" item="userid" open="(" close=")" separator=",">
#{userid}
</foreach>
</select>


申请14天超长免费试听资格
获取500G教程资料
姓名
电话
课程
立即申请