// 接口
List<SysUser> findByIdList(List<Integer> idList);
//xml
<select id="findByIdList" resultMap="BaseResultMap">
SELECT *
FROM sys_user
<where>
<if test="list!= null and list.size() > 0">
id IN
<foreach collection="list" item="item" index="index" open="(" separator="," close=")">
#{item}
</foreach>
</if>
</where>
</select>