使用myBatis如何返回integer的值

今天就跟大家聊聊有关使用myBatis如何返回integer的值,可能很多人都不太了解,为了让大家更加了解,小编给大家总结了以下内容,希望大家根据这篇文章可以有所收获。

经过测试

resultMap="java.lang.Integer"

改成

resultType="java.lang.Integer"

也可以解决问题~

补充知识:mybatis返回count(*)的整数值

1、mybatis中resultType定义为"java.lang.Integer"

<select id="selectNums" resultType="java.lang.Integer">
 select count(*) from tableName
 </select>

2、接口中返回值写成int,即可

int selectNums();

看完上述内容,你们对使用myBatis如何返回integer的值有进一步的了解吗?如果还想了解更多知识或者相关内容,请关注行业资讯频道,感谢大家的支持。