v2.6更新
This commit is contained in:
@@ -230,7 +230,8 @@ class ConductService:
|
||||
grouped: bool = False,
|
||||
related_type: Optional[str] = None,
|
||||
reason_prefix: Optional[str] = None,
|
||||
is_revoked: Optional[int] = None
|
||||
is_revoked: Optional[int] = None,
|
||||
reason_search: Optional[str] = None
|
||||
) -> Dict[str, Any]:
|
||||
"""获取历史记录"""
|
||||
# 空字符串转为None
|
||||
@@ -242,6 +243,8 @@ class ConductService:
|
||||
related_type = None
|
||||
if reason_prefix == "":
|
||||
reason_prefix = None
|
||||
if reason_search == "":
|
||||
reason_search = None
|
||||
if related_type and related_type not in ('manual', 'homework', 'attendance'):
|
||||
return {"records": [], "page": page, "page_size": page_size, "total": 0, "total_pages": 0}
|
||||
|
||||
@@ -259,7 +262,8 @@ class ConductService:
|
||||
reason_prefix=reason_prefix,
|
||||
page=page,
|
||||
page_size=page_size,
|
||||
is_revoked=is_revoked
|
||||
is_revoked=is_revoked,
|
||||
reason_search=reason_search
|
||||
)
|
||||
|
||||
records = await ConductModel.get_all_records(
|
||||
@@ -270,7 +274,8 @@ class ConductService:
|
||||
student_id=student_id,
|
||||
related_type=related_type,
|
||||
reason_prefix=reason_prefix,
|
||||
is_revoked=is_revoked
|
||||
is_revoked=is_revoked,
|
||||
reason_search=reason_search
|
||||
)
|
||||
|
||||
# 获取总数
|
||||
@@ -292,6 +297,9 @@ class ConductService:
|
||||
if reason_prefix:
|
||||
count_conditions.append("cr.reason LIKE %s")
|
||||
count_params.append(f"{reason_prefix}%")
|
||||
if reason_search:
|
||||
count_conditions.append("cr.reason LIKE %s")
|
||||
count_params.append(f"%{reason_search}%")
|
||||
if is_revoked is not None:
|
||||
count_conditions.append("cr.is_revoked = %s")
|
||||
count_params.append(1 if is_revoked else 0)
|
||||
|
||||
Reference in New Issue
Block a user