Parameter 'XXX' not found. Available parameters are [collection, list]] with root cause

在使用mybatis的时候,mapper只传了一个list集合参数,结果就报错:

Parameter 'roleIds' not found. Available parameters are [collection, list]] with root cause

就是说这个参数没有找到, 这个时候可以用@Param指定参数就行了。
mapper

import org.apache.ibatis.annotations.Param;
int deleteByIds(@Param("roleIds") List<String> roleIds);

mapper.xml

    <delete id="deleteByIds" parameterType="java.util.List">
         delete from role where id in
         <foreach collection="roleIds" item="item" separator="," open="(" close=")" >
             #{item, jdbcType=INTEGER}
         </foreach>
    </delete>
发布了10 篇原创文章 · 获赞 11 · 访问量 1684

猜你喜欢

转载自blog.csdn.net/qq_40822000/article/details/104670147