rbac/wwwroot/codes/get_codes.dspy

23 lines
528 B
Plaintext
Raw Normal View History

2024-03-12 18:46:05 +08:00
ns = params_kw.copy()
if not ns.get('page'):
ns['page'] = 1
if not ns.get('sort'):
ns['sort'] = 'name'
if ns.get('name'):
ns['name'] = '%' + params_kw['name'] + '%'
dbname = get_definition('codesdb')
print(f'dbname=', dbname)
db = DBPools()
async with db.sqlorContext(dbname) as sor:
sql = "select * from appcodes where del_flg='0' "
if ns.get('name'):
sql += ' and name like ${name}$ '
if ns.get('hierarchy_flg'):
sql += ' and hierarchy_flg = ${hierarchy}$ '
r = await sor.sqlPaging(sql, ns)
return r
return {
}