Skip to content

Commit

Permalink
fix: 修改下获取分组的排序 (#711)
Browse files Browse the repository at this point in the history
  • Loading branch information
zgqgit committed Jun 28, 2024
2 parents 7e93d25 + e9c8f00 commit c7b2cfc
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/backend/bisheng/database/models/group.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,15 @@ def insert_group(cls, group: GroupCreate) -> Group:
@classmethod
def get_all_group(cls) -> list[Group]:
with session_getter() as session:
statement = select(Group).order_by(Group.id.desc())
statement = select(Group).order_by(Group.update_time.desc())
return session.exec(statement).all()

@classmethod
def get_group_by_ids(cls, ids: List[int]) -> list[Group]:
if not ids:
raise ValueError('ids is empty')
with session_getter() as session:
statement = select(Group).where(Group.id.in_(ids)).order_by(Group.id.desc())
statement = select(Group).where(Group.id.in_(ids)).order_by(Group.update_time.desc())
return session.exec(statement).all()

@classmethod
Expand Down

0 comments on commit c7b2cfc

Please sign in to comment.