Fix in order_by webmodel
This commit is contained in:
parent
a405b06b0c
commit
913fc268cc
1 changed files with 15 additions and 7 deletions
|
|
@ -785,26 +785,34 @@ class WebModel:
|
||||||
result.close()
|
result.close()
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def set_conditions(self, sql_text, values:list) -> None:
|
def set_conditions(self, sql_text, values:list) -> object:
|
||||||
|
|
||||||
self.conditions=[sql_text, values]
|
self.conditions=[sql_text, values]
|
||||||
|
|
||||||
return self
|
return self
|
||||||
|
|
||||||
def set_order(self, order:list, position:list) -> None:
|
def set_order(self, order:dict) -> object:
|
||||||
|
|
||||||
order=[]
|
arr_order=[]
|
||||||
|
arr_order.append('ASC')
|
||||||
|
arr_order.append('DESC')
|
||||||
|
|
||||||
for o in enumerate(order):
|
final_order=[]
|
||||||
|
|
||||||
order.append('order by '+order[o]+' '+position[o])
|
for o,v in order.items():
|
||||||
|
|
||||||
|
if o in self.fields:
|
||||||
|
|
||||||
|
final_order.append('order by '+o+' '+arr_order[v])
|
||||||
|
|
||||||
self.order=", ".join(order)
|
self.order_by=", ".join(final_order)
|
||||||
|
|
||||||
return self
|
return self
|
||||||
|
|
||||||
def set_limit(self, limit: tuple) -> None:
|
def set_limit(self, limit: tuple) -> None:
|
||||||
|
|
||||||
|
limit[0]=int(limit[0])
|
||||||
|
|
||||||
sql_limit=str(limit[0])
|
sql_limit=str(limit[0])
|
||||||
|
|
||||||
if len(limit)>1:
|
if len(limit)>1:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue