Revert "fix: llm_list.dspy用JOIN查询返回upappid_text和providerid_text供前端code列显示"
This reverts commit 5c021b81cba6da9c08954d2c5e075cd1e83f45cf.
This commit is contained in:
parent
5c021b81cb
commit
d4406a60fd
@ -41,27 +41,12 @@ try:
|
|||||||
count_rows = await sor.sqlExe(count_sql, filterdic)
|
count_rows = await sor.sqlExe(count_sql, filterdic)
|
||||||
total = count_rows[0]['cnt'] if count_rows else 0
|
total = count_rows[0]['cnt'] if count_rows else 0
|
||||||
|
|
||||||
# Paginated data - JOIN with organization and upapp to get display names
|
# Paginated data
|
||||||
# Prefix field references in WHERE clause with table alias 'l.'
|
|
||||||
join_where = ''
|
|
||||||
if where_clause:
|
|
||||||
import re
|
|
||||||
conds_text = where_clause.replace(' WHERE ', '', 1)
|
|
||||||
# Add l. prefix to field names (name, model, providerid, upappid, status)
|
|
||||||
conds_text = re.sub(r'\b(name|model|description|providerid|upappid|status|ownerid)\b', r'l.\1', conds_text)
|
|
||||||
join_where = f' WHERE {conds_text}'
|
|
||||||
|
|
||||||
data_sql = f"""
|
data_sql = f"""
|
||||||
select l.id, l.name, l.model, l.description, l.iconid,
|
select id, name, model, description, iconid, upappid, providerid,
|
||||||
l.upappid, l.providerid, l.ownerid, l.enabled_date,
|
ownerid, enabled_date, expired_date, min_balance, status
|
||||||
l.expired_date, l.min_balance, l.status,
|
from llm{where_clause}
|
||||||
u.name as upappid_text,
|
order by model
|
||||||
o.orgname as providerid_text
|
|
||||||
from llm l
|
|
||||||
left join uapi.upapp u on l.upappid = u.id
|
|
||||||
left join rbac.organization o on l.providerid = o.id
|
|
||||||
{join_where}
|
|
||||||
order by l.model
|
|
||||||
limit ${limit}$ offset ${offset}$
|
limit ${limit}$ offset ${offset}$
|
||||||
"""
|
"""
|
||||||
rows = await sor.sqlExe(data_sql, {**filterdic, 'limit': rows_per_page, 'offset': offset})
|
rows = await sor.sqlExe(data_sql, {**filterdic, 'limit': rows_per_page, 'offset': offset})
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user