fix db_model bug
This commit is contained in:
parent
ef6713374e
commit
ffeadeea51
|
@ -26,10 +26,11 @@ class BaseCrud(BaseModel):
|
|||
|
||||
@classmethod
|
||||
def filtered_query(cls, session, filter_args=None, filter_kwargs=None) -> Query:
|
||||
if filter_args:
|
||||
return session.query(cls).filter(*filter_args).filter_by(**filter_kwargs)
|
||||
else:
|
||||
return session.query(cls).filter().filter_by(**filter_kwargs)
|
||||
if not filter_args:
|
||||
filter_args = []
|
||||
if not filter_kwargs:
|
||||
filter_kwargs = {}
|
||||
return session.query(cls).filter(*filter_args).filter_by(**filter_kwargs)
|
||||
|
||||
# 增
|
||||
@classmethod
|
||||
|
@ -90,10 +91,11 @@ class InfoCrud(BaseModel):
|
|||
|
||||
@classmethod
|
||||
def filtered_query(cls, session, filter_args=None, filter_kwargs=None) -> Query:
|
||||
if filter_args:
|
||||
return session.query(cls).filter(*filter_args).filter_by(**filter_kwargs)
|
||||
else:
|
||||
return session.query(cls).filter().filter_by(**filter_kwargs)
|
||||
if not filter_args:
|
||||
filter_args = []
|
||||
if not filter_kwargs:
|
||||
filter_kwargs = {}
|
||||
return session.query(cls).filter(*filter_args).filter_by(**filter_kwargs)
|
||||
|
||||
# 增
|
||||
@classmethod
|
||||
|
|
Loading…
Reference in New Issue