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

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

作者: 喵喵不吃鱼哦 | 来源:发表于2021-08-23 13:51 被阅读0次

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

    @Override
        public Page<BalanceWithdrawalVO> getWithdrawInfoList(Page page, BalanceWithdrawalDTO dto) {
            PageHelper.startPage(page.getPageNo(), page.getPageSize());
            List<BalanceWithdrawalVO> merchantIdList = storeNetBankInfoDao.selectStoreInfoByCondition(dto);
            List<BalanceWithdrawalVO> balanceWithdrawalVOList = new ArrayList<>();
            for (BalanceWithdrawalVO vo : merchantIdList) {
                //SDK已经封装掉了公共参数,这里只需要传入业务参数。以下方法为sdk的model入参方式
                BalanceWithdrawalVO balanceWithdrawalVO = new BalanceWithdrawalVO();
                try {
                    List<BalanceInfo> 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<BalanceWithdrawalVO> getWithdrawInfoList(Page page, BalanceWithdrawalDTO dto) {
            PageHelper.startPage(page.getPageNo(), page.getPageSize());
            List<BalanceWithdrawalVO> merchantIdList = storeNetBankInfoDao.selectStoreInfoByCondition(dto);
            List<BalanceWithdrawalVO> balanceWithdrawalVOList = new ArrayList<>();
            for (BalanceWithdrawalVO vo : merchantIdList) {
                //SDK已经封装掉了公共参数,这里只需要传入业务参数。以下方法为sdk的model入参方式
                BalanceWithdrawalVO balanceWithdrawalVO = new BalanceWithdrawalVO();
                try {
                    List<BalanceInfo> 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);
        }
    
    无法显示总条数

    暂存

    相关文章

      网友评论

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

          本文链接:https://www.haomeiwen.com/subject/bjqliltx.html