the problem is described as follows: using MyBatis to develop with the following problems,
2012-8-7 17:23:48 Org.apache.catalina.core.StandardWrapperValve Invoke
Serious: Servlet.service () for Servlet Springservlet threw exception
Java.lang.IllegalArgumentException:Mapped Statements collection does not contain value for Chartmapper.getspammsgcount
At Org.apache.ibatis.session.configuration$strictmap.get (configuration.java:594)
At Org.apache.ibatis.session.Configuration.getMappedStatement (configuration.java:436)
At Org.apache.ibatis.session.Configuration.getMappedStatement (configuration.java:428)
At Org.apache.ibatis.session.defaults.DefaultSqlSession.selectList (defaultsqlsession.java:77)
At Org.apache.ibatis.session.defaults.DefaultSqlSession.selectList (defaultsqlsession.java:72)
At Org.apache.ibatis.session.defaults.DefaultSqlSession.selectOne (defaultsqlsession.java:38)
At Sun.reflect.GeneratedMethodAccessor45.invoke (Unknown Source)
At Sun.reflect.DelegatingMethodAccessorImpl.invoke (delegatingmethodaccessorimpl.java:25)
At Java.lang.reflect.Method.invoke (method.java:597)
At Org.mybatis.spring.sqlsessiontemplate$sqlsessioninterceptor.invoke (sqlsessiontemplate.java:338)
At $Proxy 7.selectOne (Unknown Source)
At Org.mybatis.spring.SqlSessionTemplate.selectOne (sqlsessiontemplate.java:154)
At Com.iflytek.ecss.smss.managesystem.dao.MyBatisDao.get (mybatisdao.java:33)
At Com.iflytek.ecss.smss.managesystem.service.ChartsService.getSpamMsgCount (chartsservice.java:62)
At Com.iflytek.ecss.smss.managesystem.controller.ChartController.getSpamMsgData (chartcontroller.java:529)
At Sun.reflect.NativeMethodAccessorImpl.invoke0 (Native method)
Problem Solving:
Looking for a long time, found the cause of the problem is chartmapper.getspammsgcount this write wrong ... Because is many people development, this Mapper not I write, is another colleague writes, this Mapper incredibly is chartsMapper, this question debugging for a long time, I le a go ah ... Write this blog to encourage yourself, not to make this low-level mistake again ...
To add, the paging query statement in SQL Server is as follows: (What's row_number?). )
SELECT * FROM (
select Smscontent, sum (motimes) as Motimes,
row_number () over (order by SUM (Motimes) DESC) as Rown Umber from
stat_failuserinput
WHERE calcdate >= ' 2012-07-30 ' and calcdate <= ' 2012-08-06 ' and smscontent LI KE '%${smscontent}% '
GROUP by smscontent
) U WHERE rownumber > 0 and RowNumber <= 10