fix: 修复注册异常,删除用户异常,调整用户信息存储时间

This commit is contained in:
2025-02-23 03:58:38 +08:00
parent 5be35d8231
commit df5f2977d4
10 changed files with 984 additions and 32 deletions

View File

@@ -14,7 +14,7 @@ from annotation.auth import Auth
from annotation.log import Log
from config.constant import BusinessType, RedisKeyConfig
from controller.login import LoginController
from models import Department
from models import Department, Role
from schemas.common import BaseResponse, DeleteListParams
from schemas.department import AddDepartmentParams, GetDepartmentInfoResponse, \
GetDepartmentListResponse
@@ -201,3 +201,36 @@ async def get_department_list(
"page": page,
"pageSize": pageSize
})
@departmentAPI.get("/roleList/{id}", response_model=GetDepartmentListResponse, response_class=JSONResponse,
summary="用户获取部门角色列表")
@Log(title="获取部门角色列表", business_type=BusinessType.SELECT)
@Auth(["department:btn:list"])
async def get_department_role_list(
request: Request,
id: str = Path(..., description="部门ID"),
current_user: dict = Depends(LoginController.get_current_user)
):
sub_departments = current_user.get("sub_departments")
if id not in sub_departments:
return Response.error(msg="查询失败,无权限!")
data = await Role.filter(department__id=id).values(
id="id",
department_id="department__id",
department_name="department__name",
department_phone="department__phone",
department_principal="department__principal",
department_email="department__email",
role_name="name",
role_code="code",
role_id="id",
create_time="create_time",
update_time="update_time"
)
return Response.success(data={
"result": data,
"total": len(data),
"page": 1,
"pageSize": 9999
})