22from fastapi import APIRouter , Query
33from sqlmodel import func , or_ , select , delete as sqlmodel_delete
44from apps .system .crud .user import get_db_user , single_delete , user_ws_options
5- from apps .system .models .system_model import UserWsModel , WorkspaceModel
5+ from apps .system .models .system_model import UserWsModel
66from apps .system .models .user import UserModel
77from apps .system .schemas .auth import CacheName , CacheNamespace
88from apps .system .schemas .system_schema import PwdEditor , UserCreator , UserEditor , UserGrid , UserLanguage , UserWs
@@ -20,7 +20,6 @@ async def user_info(current_user: CurrentUser):
2020@router .get ("/pager/{pageNum}/{pageSize}" , response_model = PaginatedResponse [UserGrid ])
2121async def pager (
2222 session : SessionDep ,
23- trans : Trans ,
2423 pageNum : int ,
2524 pageSize : int ,
2625 keyword : Optional [str ] = Query (None , description = "搜索关键字(可选)" ),
@@ -35,14 +34,21 @@ async def pager(
3534 stmt = (
3635 select (
3736 UserModel ,
38- func .coalesce (func .string_agg (WorkspaceModel .name , ',' ), '' ).label ("space_name" )
37+ func .coalesce (
38+ func .array_remove (
39+ func .array_agg (UserWsModel .oid ),
40+ None
41+ ),
42+ []
43+ ).label ("oid_list" )
44+ #func.coalesce(func.string_agg(WorkspaceModel.name, ','), '').label("space_name")
3945 )
4046 .join (UserWsModel , UserModel .id == UserWsModel .uid , isouter = True )
41- .join (WorkspaceModel , UserWsModel .oid == WorkspaceModel .id , isouter = True )
47+ #.join(WorkspaceModel, UserWsModel.oid == WorkspaceModel.id, isouter=True)
48+ .where (UserModel .id != 1 )
4249 .group_by (UserModel .id )
4350 .order_by (UserModel .create_time )
4451 )
45-
4652 if status is not None :
4753 stmt = stmt .where (UserModel .status == status )
4854
@@ -73,15 +79,15 @@ async def pager(
7379 pagination = pagination ,
7480 ** filters )
7581
76- for item in user_page .items :
82+ """ for item in user_page.items:
7783 space_name: str = item['space_name']
7884 if space_name and 'i18n_default_workspace' in space_name:
7985 parts = list(map(
8086 lambda x: trans(x) if x == "i18n_default_workspace" else x,
8187 space_name.split(',')
8288 ))
8389 output_str = ','.join(parts)
84- item ['space_name' ] = output_str
90+ item['space_name'] = output_str """
8591 return user_page
8692
8793@router .get ("/ws" )
0 commit comments