Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
db_gpt
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
linyangyang
db_gpt
Commits
7678a8aa
Commit
7678a8aa
authored
Aug 15, 2024
by
张会鑫
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
代码提交
parent
66c90ffa
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
13 additions
and
12 deletions
+13
-12
.gitignore
.gitignore
+4
-1
crud.py
dbgpt/app/apps/vadmin/media/crud.py
+5
-7
media.py
dbgpt/app/apps/vadmin/media/schemas/media.py
+3
-3
views.py
dbgpt/app/apps/vadmin/media/views.py
+1
-1
No files found.
.gitignore
View file @
7678a8aa
...
@@ -186,3 +186,6 @@ thirdparty
...
@@ -186,3 +186,6 @@ thirdparty
/i18n/locales/**/**/*_ai_translated.po
/i18n/locales/**/**/*_ai_translated.po
/i18n/locales/**/**/*~
/i18n/locales/**/**/*~
/env_name
/env_name
/file
\ No newline at end of file
dbgpt/app/apps/vadmin/media/crud.py
View file @
7678a8aa
...
@@ -43,9 +43,8 @@ class MediaDal(DalBase):
...
@@ -43,9 +43,8 @@ class MediaDal(DalBase):
await
self
.
db
.
execute
(
sql
)
await
self
.
db
.
execute
(
sql
)
async
def
get_count_by_groupIds
(
self
,
ids
:
list
)
->
int
:
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
))
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
()
count
=
result
.
scalar
()
return
count
return
count
...
@@ -80,7 +79,6 @@ class QuestionDal(DalBase):
...
@@ -80,7 +79,6 @@ class QuestionDal(DalBase):
await
self
.
db
.
execute
(
sql
)
await
self
.
db
.
execute
(
sql
)
class
CorrelationDal
(
DalBase
):
class
CorrelationDal
(
DalBase
):
def
__init__
(
self
,
db
:
AsyncSession
):
def
__init__
(
self
,
db
:
AsyncSession
):
...
...
dbgpt/app/apps/vadmin/media/schemas/media.py
View file @
7678a8aa
...
@@ -36,9 +36,9 @@ class GroupOut(Group):
...
@@ -36,9 +36,9 @@ class GroupOut(Group):
class
Question
(
BaseModel
):
class
Question
(
BaseModel
):
title
:
str
title
:
str
|
None
=
None
key_word
:
str
key_word
:
str
|
None
=
None
answer
:
str
answer
:
str
|
None
=
None
group_id
:
int
|
None
=
0
group_id
:
int
|
None
=
0
...
...
dbgpt/app/apps/vadmin/media/views.py
View file @
7678a8aa
...
@@ -56,7 +56,7 @@ async def group_del(ids: IdList = Depends(), auth: Auth = Depends(FullAdminAuth(
...
@@ -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
)
media_counts
=
await
crud
.
MediaDal
(
auth
.
db
)
.
get_count_by_groupIds
(
ids
.
ids
)
if
media_counts
>
0
:
if
media_counts
>
0
:
return
ErrorResponse
(
"分组内不为空,无法删除"
)
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
(
"删除成功"
)
return
SuccessResponse
(
"删除成功"
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment