// 接口
public List<User> findByIdList(List<Integer> idList);
<select id="findByIdList" resultType="com.lxw.pojo.User">
SELECT *
FROM user
<where>
<if test="list!= null and list.size() > 0">
id IN
<foreach collection="list" item="ietm" index="index" open="(" separator="," close=")">
#{item}
</foreach>
</if>
</where>
</select>