fix:修复查询未发布博客无阅读次数的问题
This commit is contained in:
@@ -93,12 +93,15 @@ def query_unapproved_blog(db: Session) -> List[BlogResponse]:
|
||||
BlogContent.content.label("content"),
|
||||
Blog.word_count.label("wordCount"),
|
||||
Blog.read_duration.label("readDuration"),
|
||||
func.count(BlogVisit.id).label("visitCount"),
|
||||
Blog.is_approved.label("isApproved"),
|
||||
Blog.create_time.label("createTime"),
|
||||
Blog.update_time.label("updateTime")
|
||||
).where(Blog.is_approved == 0)
|
||||
.outerjoin(BlogCategory, Blog.category_id == BlogCategory.id)
|
||||
.outerjoin(BlogContent, Blog.content_id == BlogContent.id))
|
||||
.outerjoin(BlogVisit, Blog.id == BlogVisit.blog_id)
|
||||
.group_by(Blog.id)
|
||||
.order_by(desc(Blog.update_time)))
|
||||
|
||||
results = db.execute(stmt).fetchall()
|
||||
|
||||
Reference in New Issue
Block a user