mirror of
https://gh-proxy.org/https://github.com/klinsmaya/SQLBot.git
synced 2026-11-10 02:07:12 +08:00
fix: terminology page query may return empty list
This commit is contained in:
@@ -59,6 +59,10 @@ def page_terminology(session: SessionDep, current_page: int = 1, page_size: int
|
||||
total_count = session.execute(count_stmt).scalar()
|
||||
total_pages = (total_count + page_size - 1) // page_size
|
||||
|
||||
if current_page > total_pages:
|
||||
current_page = 1
|
||||
|
||||
|
||||
# 步骤3:获取分页后的父节点ID
|
||||
paginated_parent_ids = (
|
||||
parent_ids_subquery
|
||||
@@ -104,6 +108,9 @@ def page_terminology(session: SessionDep, current_page: int = 1, page_size: int
|
||||
total_count = session.execute(count_stmt).scalar()
|
||||
total_pages = (total_count + page_size - 1) // page_size
|
||||
|
||||
if current_page > total_pages:
|
||||
current_page = 1
|
||||
|
||||
paginated_parent_ids = (
|
||||
parent_ids_subquery
|
||||
.order_by(Terminology.create_time.desc())
|
||||
|
||||
Reference in New Issue
Block a user