@param注解的使用
当在dao层查询多个参数时候需使用@param这个注解否则会报以下错误,参数绑定异常,不能找到dao层所定义的方法,前端直接报500
[31mERROR[0;39m [35m5508[0;39m [2m---[0;39m [2m[nio-8080-exec-3][0;39m [36mo.a.c.c.C.[.[.[/].[dispatcherServlet] [0;39m [2m:[0;39m Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): cn.lexed.dao.AllMapper.SelectByAdminNam] with root cause
dao层对@param的使用如下
Admin SelectByAdminName(@Param("username")String username,@Param("password")String password);
总结:@Param这个注解用于dao层sql语句里的多个传参,一般在项目里可能出现在项目里检验登录时需要检查多个信息时使用