关于分页插件无法返回总条数的问题

项目使用的是Mybatis - 通用分页拦截器
正确状态:

@Override
    public Page getWithdrawInfoList(Page page, BalanceWithdrawalDTO dto) {
        PageHelper.startPage(page.getPageNo(), page.getPageSize());
        List merchantIdList = storeNetBankInfoDao.selectStoreInfoByCondition(dto);
        List balanceWithdrawalVOList = new ArrayList<>();
        for (BalanceWithdrawalVO vo : merchantIdList) {
            //SDK已经封装掉了公共参数,这里只需要传入业务参数。以下方法为sdk的model入参方式
            BalanceWithdrawalVO balanceWithdrawalVO = new BalanceWithdrawalVO();
            try {
                List amountInfo = getAmountInfo(vo.getMerchantId());
                balanceWithdrawalVO.setMerchantId(vo.getMerchantId());
                balanceWithdrawalVO.setStoreName(vo.getStoreName());
                if (Objects.isNull(amountInfo)) {
                    balanceWithdrawalVO.setBalance(null);
                } else {
                    balanceWithdrawalVO.setBalance(amountInfo.get(1).getTotalAmount());
                }
            } catch (MybankApiException e) {
                log.warn("获取余额提现数据错误【{}】", e);
            }
            balanceWithdrawalVOList.add(balanceWithdrawalVO);
        }
        merchantIdList.clear();
        merchantIdList.addAll(balanceWithdrawalVOList);
        return new Page<>(merchantIdList);
    }
正常显示

初始状态:

@Override
    public Page getWithdrawInfoList(Page page, BalanceWithdrawalDTO dto) {
        PageHelper.startPage(page.getPageNo(), page.getPageSize());
        List merchantIdList = storeNetBankInfoDao.selectStoreInfoByCondition(dto);
        List balanceWithdrawalVOList = new ArrayList<>();
        for (BalanceWithdrawalVO vo : merchantIdList) {
            //SDK已经封装掉了公共参数,这里只需要传入业务参数。以下方法为sdk的model入参方式
            BalanceWithdrawalVO balanceWithdrawalVO = new BalanceWithdrawalVO();
            try {
                List amountInfo = getAmountInfo(vo.getMerchantId());
                balanceWithdrawalVO.setMerchantId(vo.getMerchantId());
                balanceWithdrawalVO.setStoreName(vo.getStoreName());
                if (Objects.isNull(amountInfo)) {
                    balanceWithdrawalVO.setBalance(null);
                } else {
                    balanceWithdrawalVO.setBalance(amountInfo.get(1).getTotalAmount());
                }
            } catch (MybankApiException e) {
                log.warn("获取余额提现数据错误【{}】", e);
            }
            balanceWithdrawalVOList.add(balanceWithdrawalVO);
        }
        return new Page<>(balanceWithdrawalVOList);
    }
无法显示总条数

暂存

你可能感兴趣的:(关于分页插件无法返回总条数的问题)