Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
financial-system
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
xianyang
financial-system
Commits
d30feaa0
Commit
d30feaa0
authored
Apr 14, 2023
by
xianyang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化业务类目
parent
77d7a69c
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
3 deletions
+3
-3
crud.py
app/api/account/crud.py
+2
-2
views.py
app/api/account/views.py
+1
-1
No files found.
app/api/account/crud.py
View file @
d30feaa0
...
...
@@ -284,9 +284,9 @@ def update_account_type(db: Session, data):
return
False
def
get_account_type_value
(
db
:
Session
,
key
):
def
get_account_type_value
(
db
:
Session
,
key
,
type
):
"""新建类型 查询是否有重复数据"""
return
db
.
query
(
AccountType
)
.
filter
(
AccountType
.
key_value
==
key
)
.
first
()
return
db
.
query
(
AccountType
)
.
filter
(
AccountType
.
key_value
==
key
,
AccountType
.
type
==
type
)
.
first
()
def
create_type
(
db
:
Session
,
data
):
...
...
app/api/account/views.py
View file @
d30feaa0
...
...
@@ -142,7 +142,7 @@ def finance_fix(data: schemas.AccountTypeList, token=Depends(login_required), db
@
router
.
post
(
"/create/type"
)
def
create_user
(
data
:
schemas
.
CreateType
,
token
=
Depends
(
login_required
),
db
:
Session
=
Depends
(
get_db
)):
"""添加账目类型"""
res_type
=
crud
.
get_account_type_value
(
db
,
data
.
key_value
)
res_type
=
crud
.
get_account_type_value
(
db
,
data
.
key_value
,
data
.
type
)
if
res_type
:
return
HttpResultResponse
(
code
=
400
,
msg
=
HttpMessage
.
TYPE_EXIST
)
res
=
crud
.
create_type
(
db
,
data
)
...
...
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