select * from table where id in (1,2,3)
where条件中带in的都可以使用foreach标签
<select id="getTeachers" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from famous_teacher_recommend
where category in
<foreach collection="array" index="index" item="category" open="(" separator="," close=")">
#{category}
</foreach>
ORDER BY category
</select>