今天在使用的時候,遇到了這個錯誤
Parameter ‘tagIdList’ not found. Available parameters are [Collection,list]
repository接口中
public List<Tag> findAllById(List tagIdList);
mapper.xml中
<select id="findAllById" parameterType="java.util.List" resultType="Tag" >
select * from t_tag
<where>
<foreach item="id" separator="," collection="tagIdList" open="id in (" close=")">
#{id}
</foreach>
</where>
</select>
錯誤解決方法:接口中加上一個註解
public List<Tag> findAllById(@Param("tagIdList")List tagIdList);