查询使用聚合函数

查询使用聚合函数

在持久层接口中添加模糊查询方法

 /**
     * 查询总纪录条数
     */
    int findAllcount();

在用户的映射配置文件中配置

<!--查询总记录条数-->
    <select id="findAllcount" resultType="int" >
        SELECT count(*) FROM USER
    </select>

加入聚合查询的测试方法


    /*聚合查询测试*/
    @Test
    public void testfindallcount() {
        int res = userDao.findAllcount();
        System.out.println(res);
    }

猜你喜欢

转载自blog.csdn.net/weixin_44883727/article/details/106995245