Mapper.java
public interface StorageMapper extends BaseMapper<Storage> {
List<Integer> getStorageIdByChannelId(List<Integer> channelIds);
}
mapper.xml
<select id="getStorageIdByChannelId" resultType="java.lang.String">
select
storage_id
from
res_storage
<where>
<if test="#{0} != null">
channel_id in
<foreach item="tempId" collection="list" open="(" separator="," close=")">
#{tempId}
</foreach>
</if>
</where>
</select>
resultType设置成String,myBatis会自动将结果转成List集合。