Work on sort of ressults using the priorty and sort fields.
This commit is contained in:
@@ -47,22 +47,22 @@ def get_lu_post_topic_rec_list(
|
||||
|
||||
if account_id:
|
||||
data['account_id'] = account_id
|
||||
sql_account_id = f'`tbl`.account_id = :account_id'
|
||||
sql_account_id = f'`lu_post_topic`.account_id = :account_id'
|
||||
else:
|
||||
sql_account_id = ''
|
||||
|
||||
if for_type:
|
||||
data['for_type'] = for_type
|
||||
sql_for_type = f'AND `tbl`.for_type = :for_type'
|
||||
sql_for_type = f'AND `lu_post_topic`.for_type = :for_type'
|
||||
else:
|
||||
sql_for_type = ''
|
||||
|
||||
if inc_admin_options:
|
||||
data['admin_option'] = [0, 1]
|
||||
sql_admin_option = f'AND `tbl`.admin_option IN :admin_option'
|
||||
sql_admin_option = f'AND `lu_post_topic`.admin_option IN :admin_option'
|
||||
else:
|
||||
data['admin_option'] = [0]
|
||||
sql_admin_option = f'AND `tbl`.admin_option IN :admin_option'
|
||||
sql_admin_option = f'AND `lu_post_topic`.admin_option IN :admin_option'
|
||||
|
||||
if limit:
|
||||
data['limit'] = limit
|
||||
@@ -71,13 +71,13 @@ def get_lu_post_topic_rec_list(
|
||||
sql_limit = ''
|
||||
|
||||
sql = f"""
|
||||
SELECT * /*`tbl`.id AS 'lu_post_topic_id'*/
|
||||
FROM `lu_post_topic` AS `tbl`
|
||||
SELECT * /*`lu_post_topic`.id AS 'lu_post_topic_id'*/
|
||||
FROM `lu_post_topic` AS `lu_post_topic`
|
||||
WHERE
|
||||
{sql_account_id}
|
||||
{sql_for_type}
|
||||
{sql_admin_option}
|
||||
ORDER BY `tbl`.sort DESC
|
||||
ORDER BY -`lu_post_topic`.sort DESC
|
||||
{sql_limit};
|
||||
"""
|
||||
|
||||
|
||||
Reference in New Issue
Block a user