Skip to content

Commit 5963561

Browse files
committed
refactor: system variable sort by name
1 parent bb30a3a commit 5963561

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

backend/apps/system/crud/system_variable.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,11 @@ def delete(session: SessionDep, ids: List[int]):
3838
def list_all(session: SessionDep, trans: Trans, variable: SystemVariable):
3939
if variable.name is None:
4040
records = session.query(SystemVariable).order_by(SystemVariable.type.desc(),
41-
SystemVariable.create_time.desc()).all()
41+
SystemVariable.name.asc()).all()
4242
else:
4343
records = session.query(SystemVariable).filter(
4444
and_(SystemVariable.name.like(f'%{variable.name}%'), SystemVariable.type != 'system')).order_by(
45-
SystemVariable.type.desc(), SystemVariable.create_time.desc()).all()
45+
SystemVariable.type.desc(), SystemVariable.name.asc()).all()
4646

4747
res = []
4848
for r in records:
@@ -59,11 +59,11 @@ async def list_page(session: SessionDep, trans: Trans, pageNum: int, pageSize: i
5959
filters = {}
6060

6161
if variable.name is None:
62-
stmt = select(SystemVariable).order_by(SystemVariable.type.desc(), SystemVariable.create_time.desc())
62+
stmt = select(SystemVariable).order_by(SystemVariable.type.desc(), SystemVariable.name.asc())
6363
else:
6464
stmt = select(SystemVariable).where(
6565
and_(SystemVariable.name.like(f'%{variable.name}%'), SystemVariable.type != 'system')).order_by(
66-
SystemVariable.type.desc(), SystemVariable.create_time.desc())
66+
SystemVariable.type.desc(), SystemVariable.name.asc())
6767

6868
variable_page = await paginator.get_paginated_response(
6969
stmt=stmt,

0 commit comments

Comments
 (0)