项目整合-后端:Mybatis Plus分页Page total始终为0

看一下我们api文档:

{
  "code": 200,
  "message": "成功",
  "data": {
    "records": [
      {
        "id": 1,
        "createTime": "2021-08-17 08:51:22",
        "updateTime": "2021-08-17 08:52:11",
        "isDeleted": 0,
        "param": {},
        "hosname": "北京国际医院",
        "hoscode": "1000_2",
        "apiUrl": "http://localhost:9999",
        "signKey": "674c4137707728439a6510eae12deea9",
        "contactsName": "万物",
        "contactsPhone": "12888888888",
        "status": 0
      },
      {
        "id": 2,
        "createTime": "2021-08-17 08:50:19",
        "updateTime": "2021-08-17 08:51:58",
        "isDeleted": 0,
        "param": {},
        "hosname": "北京妇科医院",
        "hoscode": "1000_3",
        "apiUrl": "1",
        "signKey": "674c4137707728439a6510eae12deea9",
        "contactsName": "李四",
        "contactsPhone": "13888888888",
        "status": 1
      }
    ],
    "total": 0,
    "size": 2,
    "current": 1,
    "orders": [],
    "optimizeCountSql": true,
    "hitCount": false,
    "countId": null,
    "maxLimit": null,
    "searchCount": true,
    "pages": 2
  },
  "ok": true
}

原因:
旧版分页插件添加
我们可以看到上面的分页插件功能已经弃用了,使用新版:

// 最新版
    @Bean
    public MybatisPlusInterceptor mybatisPlusInterceptor() {
        MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
        interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.H2));
        return interceptor;
    }

结果:
在这里插入图片描述
大爷们,走之前,给个赞呗

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值