public List<Map> statistic(final Map<String,Object> paramMap) {
// 按同步状态统计
// final Map<String,Object> paramMap = new HashMap<>();
paramMap.put("statusStatistic","1");
paramMap.put("status",1);
List<Map> result = formSyncTaskMapper.statistic(paramMap);
paramMap.put("status","0");
List<Map> inRunResult = formSyncTaskMapper.statistic(paramMap);
result.addAll(inRunResult);
paramMap.clear();
paramMap.put("platformStatistic","1");
List<Map> platFormResult = formSyncTaskMapper.statistic(paramMap);
result.addAll(platFormResult);
return result;
}
原 SQL
<select id="statistic" parameterType="java.util.Map" resultType="java.util.Map">
<if test="statusStatistic != null and status != ''">
SELECT count(0) taskInfo FROM form_sync_task formTask LEFT JOIN sys_job sysjob ON task_id = job_id
where sysjob.status = 1
</if>
<if test="platformStatistic != null">
SELECT sync_platform ,count(sync_platform) platformInfo FROM form_sync_task formTask
group by sync_platform
</if>
</select>
期望的结果:
完整异常信息
Caused by: org.apache.ibatis.exceptions.PersistenceException:
### Error querying database. Cause: java.lang.NullPointerException
### Cause: java.lang.NullPointerException
at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:30)
at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:153)
at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:145)
at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:140)
at sun.reflect.GeneratedMethodAccessor125.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:427)
... 127 common frames omitted
Caused by: java.lang.NullPointerException: null
at com.github.pagehelper.PageHelper.beforeCount(PageHelper.java:58)
at com.github.pagehelper.PageInterceptor.intercept(PageInterceptor.java:119)
at org.apache.ibatis.plugin.Plugin.invoke(Plugin.java:62)
at com.sun.proxy.$Proxy221.query(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.ibatis.plugin.Invocation.proceed(Invocation.java:49)
at com.union.framework.interceptor.PageDialectInterceptor.intercept(PageDialectInterceptor.java:65)
at org.apache.ibatis.plugin.Plugin.invoke(Plugin.java:62)
at com.sun.proxy.$Proxy221.query(Unknown Source)
at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:151)
... 133 common frames omitted
异常模板
使用环境
分页报空指错误
分页参数
原 SQL
期望的结果:
完整异常信息
其他类型的错误
功能建议
目前发现此情况下会导致分页中方言代事会丢失,导致空指异常。