扩展mybatisPlus 分页page对象字段

1.先自定义类集成page

package com.pta.guest.manage.domain.vo;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;

/**
 * @ClassName TestPage
 * @Author Liang Qizhao
 * @Date 2023/2/9 15:25
 * @Version 1.0
 */
public class TestPage<T> extends Page<T> {

    private String qqq;

    public TestPage(long current, long size) {
        super(current, size, 0);
    }

    public String getQqq() {
        return qqq;
    }

    public void setQqq(String qqq) {
        this.qqq = qqq;
    }
}

2.分页查询时重新构建page对象,入参page类和返回page要统一才行,不然会包类转换异常

@Override
   public IPage<PtaMiddlemanSettleRecord> pageList(PtaMiddlemanRecordListDto dto) {
        TestPage<PtaMiddlemanSettleRecord> page = new TestPage<>(dto.getPageNo(), dto.getPageSize());
        String tenantId = SecurityUtils.getTenantId();
        TestPage<PtaMiddlemanSettleRecord> recordIPage = ptaMiddlemanSettleRecordMapper.pageList(page, tenantId, dto);
        recordIPage.setQqq("123");
        return recordIPage;
    }

扩展mybatisPlus 分页page对象字段_第1张图片
扩展mybatisPlus 分页page对象字段_第2张图片

你可能感兴趣的:(java,开发语言)