龚焕茏
2024-09-03 123cf89ee4b76d1355b5bb9eaf70538c5264f18c
ycl-server/src/main/java/com/ycl/platform/service/impl/DataCenterServiceImpl.java
@@ -62,9 +62,20 @@
        long total = mongoTemplate.count(query, VideoOnlineResult.class);
        query.with(Sort.by(Sort.Order.asc(TIME_FIELD))).skip(params.getSkipNum()).limit(Math.toIntExact(params.getPageSize()));
        List<VideoOnlineResult> resultList = mongoTemplate.find(query, VideoOnlineResult.class);
        long count = mongoTemplate.count(new Query(), VideoOnlineResult.class);
        // 统计
        Criteria criteriaCount = new Criteria();
        // 普通查询
        if (Objects.nonNull(params.getStartTime()) && Objects.nonNull(params.getEndTime())) {
            criteriaCount.andOperator(
                    Criteria.where(TIME_FIELD).gte(params.getStartTime()).lte(params.getEndTime())
            );
        }
        Query countQuery = new Query();
        countQuery.addCriteria(criteriaCount);
        long count = mongoTemplate.count(countQuery, VideoOnlineResult.class);
        HashMap<String, Object> map = new HashMap<>();
        map.put("total", count);
        map.put("count", Arrays.asList(count));
        map.put("list", resultList);
        return Result.ok().data(map).total(total);
    }
@@ -1017,7 +1028,11 @@
        Page<ImageResourceSecurityDetail> page = PageHelper.startPage(query.getPageNum(), query.getPageSize());
        securityDetailMapper.selectImageResourceSecurityDetailList(imageResourceSecurityDetail);
        return  Result.ok().data(page.getResult()).total(page.getTotal());
        // 统计数
        HashMap<String, Object> map = new HashMap<>();
        map.put("count", CollectionUtils.EMPTY_COLLECTION);
        map.put("list", page);
        return Result.ok().data(map).total(page.getTotal());
    }
}