Google半天没啥结果,最后把分页换成了 limit和offset 组合

const topic = this
.createQueryBuilder('post')
.leftJoinAndSelect(Topic, 'topic', 'post.topic_id = topic.id')
.select('topic.id, topic.name')
.addSelect('SUM(1)', 'count')
.groupBy('post.topic_id')
.addGroupBy('topic.id')
.where('post.topic_id is not null AND post.status = :status', { status: PostStatus.Active })
.orderBy('count', sortBy)
// .skip(pageIndex * pageSize)
// .take(pageSize)
.limit(pageSize)
.offset(pageIndex * pageSize)
.getRawMany();