MyBatis:Parameter Maps collection does not contain value for 报错问题解决收录
1.报错收录
后端测试时偶然遇到的用mybatis生成好的mapper文件,报Result Maps collection does not contain value…的错误
2.报错分析
java.lang.ILledalAraumentException: arameter Maps collection does not contain value for com.lany.pear-admin_crud.mapper.RoleMaper.role
parameterMap=”com.lany.pear-admin_crud.mapper.RoleMaper.role”
parameterType=”com.lany.pear-admin_crud.mapper.RoleMaper.role”示例用法区别无二
粗略比对参数的映射文件,并未发现异常,细究排查后发现写的mapper方法,自动补全使参数类型默认输入parameterMap
将参数修改为parameterType再测试
3.问题解决
注:SQL映射的XML文件mybatis官方已将parameterMap废弃,现在使用parameterType来处理,但自动补全还是会优先添加parameterMap。
了解更多知识请戳下: