select query
This commit is contained in:
+13
-1
@@ -444,7 +444,7 @@ def office_login():
|
||||
@app.route('/office/loan/select')
|
||||
def loan_select():
|
||||
result_data = {
|
||||
"data": office_loan_data('SELECT'),
|
||||
"data": office_loan_data_select('SELECT'),
|
||||
"extra" : []
|
||||
}
|
||||
return {
|
||||
@@ -471,6 +471,18 @@ def loan_approved():
|
||||
"result_data": result_data,
|
||||
}, 200
|
||||
|
||||
def office_loan_data_select(loanLevel):
|
||||
|
||||
SELECT_Q = f'''SELECT ls.id,ls.added::text, dm.name,dm.mobile, ls.bvn , ls.loan,lo.description FROM loan_select ls LEFT JOIN loan_offers lo ON lo.loan=ls.loan
|
||||
LEFT JOIN demo_bank_accounts dm ON dm.bvn = ls.bvn ORDER BY ls.id DESC LIMIT 300 '''
|
||||
|
||||
with connection:
|
||||
with connection.cursor(cursor_factory=psycopg2.extras.DictCursor) as cursor:
|
||||
cursor.execute(SELECT_Q)
|
||||
select_demoS = cursor.fetchall()
|
||||
|
||||
demo_data = json.dumps( [dict(ix) for ix in select_demoS] )
|
||||
return json.loads( demo_data)
|
||||
|
||||
def office_loan_data(loanLevel):
|
||||
# public | loan_apply | table | salaryloan
|
||||
|
||||
Reference in New Issue
Block a user