Commit 7678a8aa authored by 张会鑫's avatar 张会鑫

代码提交

parent 66c90ffa
......@@ -186,3 +186,6 @@ thirdparty
/i18n/locales/**/**/*_ai_translated.po
/i18n/locales/**/**/*~
/env_name
/file
\ No newline at end of file
......@@ -43,9 +43,8 @@ class MediaDal(DalBase):
await self.db.execute(sql)
async def get_count_by_groupIds(self, ids: list) -> int:
async with Session() as session:
stmt = select(func.count(self.model.id)).where(self.model.group_id.in_(ids))
result = await session.execute(stmt)
result = await self.db.execute(stmt)
count = result.scalar()
return count
......@@ -80,7 +79,6 @@ class QuestionDal(DalBase):
await self.db.execute(sql)
class CorrelationDal(DalBase):
def __init__(self, db: AsyncSession):
......
......@@ -36,9 +36,9 @@ class GroupOut(Group):
class Question(BaseModel):
title: str
key_word: str
answer: str
title: str | None = None
key_word: str | None = None
answer: str | None = None
group_id: int | None = 0
......
......@@ -56,7 +56,7 @@ async def group_del(ids: IdList = Depends(), auth: Auth = Depends(FullAdminAuth(
media_counts = await crud.MediaDal(auth.db).get_count_by_groupIds(ids.ids)
if media_counts > 0:
return ErrorResponse("分组内不为空,无法删除")
# await crud.GroupDal(auth.db).delete_datas(ids.ids, v_soft=True)
await crud.GroupDal(auth.db).delete_datas(ids.ids, v_soft=True)
return SuccessResponse("删除成功")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment