写foreach语句的时候报的错Parameter ‘ordersList’ not found. Available parameters are [Collection,list] 。去查阅了一下发现在Mappr.xml中是 collection=" List" 的
如果Mapper.java是这样的
void insertNewRelationship(@Param("roleId") Integer roleId, List<Integer> authIdList);
Mapper.xml这样写就报错
<foreach collection="authIdList" item="authId" separator=",">(#{authId},#{roleId})</foreach>
解决方法:
可以把collection=" xxxList" 改成 “List”
或者改Mapper.xml
void insertNewRelationship(@Param("roleId") Integer roleId, @Param("authIdList") List<Integer> authIdList);