v2.5更新
This commit is contained in:
@@ -76,6 +76,12 @@ class SubjectModel:
|
||||
|
||||
@staticmethod
|
||||
async def delete(subject_id: int) -> bool:
|
||||
"""软删除科目(设置 is_active = 0),如果已禁用也返回成功"""
|
||||
subject = await SubjectModel.get_by_id(subject_id)
|
||||
if not subject:
|
||||
return False
|
||||
if subject.get("is_active") == 0:
|
||||
return True # 已禁用,视为成功
|
||||
sql = "UPDATE subjects SET is_active = 0 WHERE subject_id = %s"
|
||||
result = await execute_update(sql, (subject_id,))
|
||||
return result > 0
|
||||
|
||||
Reference in New Issue
Block a user