commit by Kalman.CHENG ☆

This commit is contained in:
chengminglong
2025-08-22 09:35:08 +08:00
parent 5efb48837c
commit c0af12e909
2 changed files with 9 additions and 2 deletions

View File

@@ -81,7 +81,7 @@ async def save(request: Request):
bureau_id = await get_request_str_param(request, "bureau_id", True, True)
# 校验参数
check_theme_sql = "SELECT theme_name FROM t_ai_teaching_model_theme WHERE is_deleted = 0 and bureau_id = '" + bureau_id + "' and theme_name = '" + theme_name + "'"
check_theme_sql = f"SELECT theme_name FROM t_ai_teaching_model_theme WHERE is_deleted = 0 and stage_id = {stage_id} and subject_id = {subject_id} and bureau_id = '{bureau_id}' and theme_name = '{theme_name}'"
if id != 0:
check_theme_sql += " and id <> " + str(id)
print(check_theme_sql)
@@ -138,6 +138,11 @@ async def get(request: Request):
async def delete(request: Request):
# 获取参数
id = await get_request_num_param(request, "id", True, True, None)
# 查询该主题下是否存在有效文档
check_document_sql: str = f"SELECT id FROM t_ai_teaching_model_document WHERE is_deleted = 0 and theme_id = {id}"
check_document_result = await find_by_sql(check_document_sql,())
if check_document_result is not None:
return {"success": False, "message": "该主题下存在有效文档,不能删除!"}
result = await delete_by_id("t_ai_teaching_model_theme", "id", id)
if not result:
return {"success": False, "message": "删除失败!"}