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