style: 使用ruff格式化登录模块,优化导入

This commit is contained in:
insistence
2024-07-12 09:35:26 +08:00
parent 40a8c73461
commit bd242c95f7
4 changed files with 241 additions and 147 deletions

View File

@@ -1,7 +1,7 @@
from sqlalchemy import select, and_
from sqlalchemy import and_, select
from sqlalchemy.ext.asyncio import AsyncSession
from module_admin.entity.do.user_do import SysUser
from module_admin.entity.do.dept_do import SysDept
from module_admin.entity.do.user_do import SysUser
async def login_by_account(db: AsyncSession, user_name: str):
@@ -11,11 +11,17 @@ async def login_by_account(db: AsyncSession, user_name: str):
:param user_name: 用户名
:return: 用户对象
"""
user = (await db.execute(
select(SysUser, SysDept)
user = (
await db.execute(
select(SysUser, SysDept)
.where(SysUser.user_name == user_name, SysUser.del_flag == '0')
.join(SysDept, and_(SysUser.dept_id == SysDept.dept_id, SysDept.status == '0', SysDept.del_flag == '0'), isouter=True)
.join(
SysDept,
and_(SysUser.dept_id == SysDept.dept_id, SysDept.status == '0', SysDept.del_flag == '0'),
isouter=True,
)
.distinct()
)).first()
)
).first()
return user