springboot如何集成mybatis的pagehelper分页插件

mybatis提供了一个非常好用的分页插件,之前集成的时候需要配置mybatis-config.xml的方式,今天我们来看下它是如何集成springboot来更好的服务的。

只能说springboot的强大之处真是不容小觑。

第一步:添加依赖

第二步:配置文件简单:

第三步:编写代码:

第四步效果:

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

{

  "status": 0,

  "data": {

    "pageNum": 1,

    "pageSize": 1,

    "size": 1,

    "startRow": 0,

    "endRow": 0,

    "total": 1,

    "pages": 1,

    "list": [

      {

        "id": 26,

        "categoryId": 100002,

        "name""Apple iPhone 7 Plus (A1661) 128G 玫瑰金色 移动联通电信4G手机",

        "subtitle""iPhone 7,现更以红色呈现。",

        "mainImage""241997c4-9e62-4824-b7f0-7425c3c28917.jpeg",

        "status"null,

        "price": 6999

      }

    ],

    "prePage": 0,

    "nextPage": 0,

    "isFirstPage"true,

    "isLastPage"true,

    "hasPreviousPage"false,

    "hasNextPage"false,

    "navigatePages": 8,

    "navigatepageNums": [

      1

    ],

    "navigateFirstPage": 1,

    "navigateLastPage": 1,

    "firstPage": 1,

    "lastPage": 1

  }

}

  看到没,springboot集成了这个插件就是这么的简单!

猜你喜欢

转载自blog.csdn.net/weixin_33207551/article/details/84651374