org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.binding.BindingException: Parameter 'role_id' not found. Available parameters are [arg1, arg0, param1, param2]
这是因为在你的mybatis的Mapper接口方法传入了多个参数,如
List<Map<String,Object>> loadRight(String role_id,String parent_code);
你的配置文件如:
<select id="loadRight" resultType="hashmap" >
select rf.rf_role_id,y.right_code,y.right_text,y.right_url,y.right_parent_code from sys_role_right rf inner JOIN sys_right y on y.right_code=rf.rf_right_code
where rf.rf_role_id=#{role_id} and y.right_parent_code=#{parent_code}
</select>
所导致的解决方法为:
修改xml文件
1.使用arg1, arg0
代码如下:
<select id="loadRight" resultType="hashmap" >
select rf.rf_role_id,y.right_code,y.right_text,y.right_url,y.right_parent_code from sys_role_right rf inner JOIN sys_right y on y.right_code=rf.rf_right_code
where rf.rf_role_id=#{arg0} and y.right_parent_code=#{arg1}
</select>
1.2使用param1, param2
<select id="loadRight" resultType="hashmap" >
select rf.rf_role_id,y.right_code,y.right_text,y.right_url,y.right_parent_code from sys_role_right rf inner JOIN sys_right y on y.right_code=rf.rf_right_code
where rf.rf_role_id=#{param1} and y.right_parent_code=#{param2}
</select>
2.修改java代码
List<Map<String,Object>> loadRight(@Param("role_id") String role_id,@Param("parent_code") String parent_code);