修复考勤管理bug并加强了信息保护
This commit is contained in:
@@ -196,7 +196,8 @@ class ConductService:
|
||||
page_size: int = 20,
|
||||
start_date: Optional[str] = None,
|
||||
end_date: Optional[str] = None,
|
||||
grouped: bool = False
|
||||
grouped: bool = False,
|
||||
related_type: Optional[str] = None
|
||||
) -> Dict[str, Any]:
|
||||
"""获取历史记录"""
|
||||
# 空字符串转为None
|
||||
@@ -204,6 +205,8 @@ class ConductService:
|
||||
start_date = None
|
||||
if end_date == "":
|
||||
end_date = None
|
||||
if related_type == "":
|
||||
related_type = None
|
||||
|
||||
role = await PermissionChecker.get_user_role(user_id)
|
||||
offset = (page - 1) * page_size
|
||||
@@ -224,7 +227,8 @@ class ConductService:
|
||||
offset=offset,
|
||||
start_date=start_date,
|
||||
end_date=end_date,
|
||||
student_id=student_id
|
||||
student_id=student_id,
|
||||
related_type=related_type
|
||||
)
|
||||
|
||||
# 获取总数
|
||||
@@ -240,6 +244,9 @@ class ConductService:
|
||||
if end_date:
|
||||
count_conditions.append("DATE(cr.created_at) <= %s")
|
||||
count_params.append(end_date)
|
||||
if related_type:
|
||||
count_conditions.append("cr.related_type = %s")
|
||||
count_params.append(related_type)
|
||||
count_where = " AND ".join(count_conditions)
|
||||
count_sql = f"""
|
||||
SELECT COUNT(*) as total FROM conduct_records cr
|
||||
|
||||
Reference in New Issue
Block a user