MyBatis中param的作用
param就是得到方法中参数的名字,MyBatis通过参数名字得到参数的值例如:
在写代码时,尽量保持Param中的名字与所传参数名一致,这样比较好区分。
多个参数时,参数必须要用Param注解,单个参数可以不用,但还是建议使用。
多个参数不使用注解时会报2019-02-18 15:14:00.489 |DESKTOP-25P9U7B| [http-nio-8101-exec-14] ERROR o.a.c.core.ContainerBase.[Tomcat].[localhost].[/].[dispatcherServlet]:182 - Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.binding.BindingException: Parameter 'status' not found. Available parameters are [arg1, id, param1, param2]] with root cause
org.apache.ibatis.binding.BindingException: Parameter 'status' not found. Available parameters are [arg1, id, param1, param2]
第一次写博客,大佬们轻点喷。