Mapper.java:
public interface testMapper {
List<User> getUsers(List<Integer> idList);
}
mapper.xml:
<select id="getUsers" resultType="User">
select * from
<where>
<if test="idList.size()>0 and idList != null ">
channel_id in
<foreach item="tempId" collection="idList" open="(" separator="," close=")">
#{tempId}
</foreach>
</if>
</where>
</select>