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

代码提交

parent 66c90ffa
......@@ -185,4 +185,7 @@ thirdparty
/examples/**/*.gv.pdf
/i18n/locales/**/**/*_ai_translated.po
/i18n/locales/**/**/*~
/env_name
\ No newline at end of file
/env_name
/file
\ No newline at end of file
......@@ -43,11 +43,10 @@ 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)
count = result.scalar()
return count
stmt = select(func.count(self.model.id)).where(self.model.group_id.in_(ids))
result = await self.db.execute(stmt)
count = result.scalar()
return count
class GroupDal(DalBase):
......@@ -80,11 +79,10 @@ class QuestionDal(DalBase):
await self.db.execute(sql)
class CorrelationDal(DalBase):
def __init__(self, db: AsyncSession):
super(CorrelationDal, self).__init__()
self.db = db
self.model = models.VadminCorrelation
self.schema = schemas.CorrelationOut
\ No newline at end of file
self.schema = schemas.CorrelationOut
......@@ -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