出现以下问题,解决的方式为,
问题的原因:UserMapper中用了parameterMap
解决方式:把 映射文件中的parameterMap换为parameterType
org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.apache.ibatis.builder.IncompleteElementException: Could not find parameter map com.hzit.dao.UserDao.UserResultMap
org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:982)
org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:872)
javax.servlet.http.HttpServlet.service(HttpServlet.java:650)
org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846)
javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:197)
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
root cause
org.apache.ibatis.builder.IncompleteElementException: Could not find parameter map com.hzit.dao.UserDao.UserResultMap
org.apache.ibatis.builder.MapperBuilderAssistant.getStatementParameterMap(MapperBuilderAssistant.java:320)
org.apache.ibatis.builder.MapperBuilderAssistant.addMappedStatement(MapperBuilderAssistant.java:296)
org.apache.ibatis.builder.xml.XMLStatementBuilder.parseStatementNode(XMLStatementBuilder.java:109)
org.apache.ibatis.session.Configuration.buildAllStatements(Configuration.java:760)
org.apache.ibatis.session.Configuration.hasStatement(Configuration.java:730)
org.apache.ibatis.session.Configuration.hasStatement(Configuration.java:725)
org.apache.ibatis.binding.MapperMethod$SqlCommand.(MapperMethod.java:210)
org.apache.ibatis.binding.MapperMethod.(MapperMethod.java:48)
org.apache.ibatis.binding.MapperProxy.cachedMapperMethod(MapperProxy.java:59)
org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:52)
com.sun.proxy.$Proxy23.getById(Unknown Source)
com.hzit.service.UserService.login(UserService.java:19)
com.hzit.controller.UserController.login(UserController.java:22)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
java.lang.reflect.Method.invoke(Unknown Source)
org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:205)
org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:133)
org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:97)
org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:827)
org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:738)
org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85)
org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:967)
org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:901)
org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970)
org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:872)
javax.servlet.http.HttpServlet.service(HttpServlet.java:650)
org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846)
javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:197)
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
root cause
java.lang.IllegalArgumentException: Parameter Maps collection does not contain value for com.hzit.dao.UserDao.UserResultMap
org.apache.ibatis.session.Configuration$StrictMap.get(Configuration.java:860)
org.apache.ibatis.session.Configuration.getParameterMap(Configuration.java:632)
org.apache.ibatis.builder.MapperBuilderAssistant.getStatementParameterMap(MapperBuilderAssistant.java:318)
org.apache.ibatis.builder.MapperBuilderAssistant.addMappedStatement(MapperBuilderAssistant.java:296)
org.apache.ibatis.builder.xml.XMLStatementBuilder.parseStatementNode(XMLStatementBuilder.java:109)
org.apache.ibatis.session.Configuration.buildAllStatements(Configuration.java:760)
org.apache.ibatis.session.Configuration.hasStatement(Configuration.java:730)
org.apache.ibatis.session.Configuration.hasStatement(Configuration.java:725)
org.apache.ibatis.binding.MapperMethod$SqlCommand.(MapperMethod.java:210)
org.apache.ibatis.binding.MapperMethod.(MapperMethod.java:48)
org.apache.ibatis.binding.MapperProxy.cachedMapperMethod(MapperProxy.java:59)
org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:52)
com.sun.proxy.$Proxy23.getById(Unknown Source)
com.hzit.service.UserService.login(UserService.java:19)
com.hzit.controller.UserController.login(UserController.java:22)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
java.lang.reflect.Method.invoke(Unknown Source)
org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:205)
org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:133)
org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:97)
org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:827)
org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:738)
org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85)
org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:967)
org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:901)
org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970)
org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:872)
javax.servlet.http.HttpServlet.service(HttpServlet.java:650)
org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846)
javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:197)
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
修改后的UserMapper
INSERT INTO staff (staffname, loginname, passwords, sex, age, phonenumber, isstaff, ismanager, birthday, adress)
VALUES(#{staffname}, #{loginname}, #{passwords}, #{sex}, #{age}, #{phonenumber}, #{isstaff}, #{ismanager}, #{birthday}, #{adress})
delete from staff where loginname=#{id};
update staff
staffname=#{user.staffname1}
loginname=#{user.loginname1}
passwords=#{user.passwords1}
sex=#{user.sex1}
age=#{user.age1}
phonenumber=#{user.phonenumber1}
isstaff=#{user.isstaff1}
ismanager=#{user.ismanager1}
birthday=#{user.birthday1}
adress=#{user.adress1}