mybatis返回count(*)的整数值

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

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

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

int selectNums();

欢迎关注微信公众号“Java面试达人”,(id:javasuperman),收看更多精彩内容

原文地址:https://www.cnblogs.com/javasuperman/p/10720691.html