SpringBoot整合ibeetlSQL的分页查询简单实现

续接 SpringBoot整合ibeetlSQL的简单实现

1.user.md文件新增内容:

2.UserController新增内容:

    @ResponseBody
    @RequestMapping("/selectByPage")
    public List selectByPage(){
        return userService.selectByPage(1,2);
    }

3.UserService新增内容:

    public List selectByPage(int start, int offset){
        return userDao.selectByPage(start, offset);
    }

4.UserDao新增内容:

    List selectByPage(@Param("start") int start, @Param("offset") int offset);

5.数据库新增内容:

    INSERT INTO user (`id`,`name`,`department_id`,`create_time`) VALUES (2,'jack',101,'2018-11-18');
    INSERT INTO user (`id`,`name`,`department_id`,`create_time`) VALUES (3,'james',101,'2018-11-18');
    INSERT INTO user (`id`,`name`,`department_id`,`create_time`) VALUES (4,'jen',101,'2018-11-18');
    INSERT INTO user (`id`,`name`,`department_id`,`create_time`) VALUES (5,'june',101,'2018-11-18');
    INSERT INTO user (`id`,`name`,`department_id`,`create_time`) VALUES (6,'july',101,'2018-11-18');
    commit;

-------------------------

启动项目,访问:http://localhost:8080/selectByPage,结果:

[{"id":2,"name":"jack","departmentId":101,"createTime":"2018-11-17T16:00:00.000+0000"},{"id":3,"name":"james","departmentId":101,"createTime":"2018-11-17T16:00:00.000+0000"}]

 

你可能感兴趣的:(beetlSQL)