如题,然后就出现了如下的问题:
org.apache.ibatis.binding.BindingException: Mapper method 'com.zlw.mapper.CommonMapper.queryIntegraInfo attempted to return null from a method with a primitive return type (int).
at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:69)
at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:43)
at com.sun.proxy.$Proxy13.queryIntegraInfo(Unknown Source)
at com.zlw.test.Test.test(Test.java:108)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
配置:
<!-- 获取当天是否登录过 -->
<select id="queryIntegraInfo" parameterType="java.util.Map" statementType="CALLABLE" resultType="java.lang.Integer">
{CALL PRC_MOBILE_QUERYINTEGRAINFO(
#{openId, mode=IN},
#{type, mode=IN},
#{isIntegra, mode=OUT, jdbcType=INTEGER}
)}
</select>
java:
integer queryIntegraInfo(Map<String, Object> map);
乍一看,没有任何毛病,但是仔细一看java代码。代表这个方法返回了一个Integer的类型数据。但是实际并不是这样的。
由于我的入参形式是map形式。返回是自动会放在map里面的。而不是直接以Integer的形式放回。
要用map.get(“isIntegra”)的方式去获取!!!
java: 改成:void queryIntegraInfo(Map<String, Object> map);就好了
找了好久这个问题、还是不仔细导致的问题。