账号新增cl_name字段,底层搜索新增account_id的[]类型in搜索
This commit is contained in:
@@ -33,7 +33,7 @@ class AccountService:
|
||||
def search_accounts(db: Session, account_id: Optional[int] = None,
|
||||
username: Optional[str] = None, project_name: Optional[str] = None,
|
||||
status: Optional[int] = None, today_updated: Optional[int] = None,
|
||||
yh_id: Optional[str] = None) -> List[AccountResponse]:
|
||||
yh_id: Optional[str] = None, cl_name: Optional[str] = None) -> List[AccountResponse]:
|
||||
"""根据多种条件搜索账号"""
|
||||
query = db.query(Account)
|
||||
|
||||
@@ -49,6 +49,8 @@ class AccountService:
|
||||
query = query.filter(Account.today_updated == today_updated)
|
||||
if yh_id is not None:
|
||||
query = query.filter(Account.yh_id == yh_id)
|
||||
if cl_name is not None:
|
||||
query = query.filter(Account.cl_name.like(f"%{cl_name}%"))
|
||||
|
||||
accounts = query.all()
|
||||
return [AccountResponse.from_orm_account(account) for account in accounts]
|
||||
|
||||
Reference in New Issue
Block a user