删除curd层

This commit is contained in:
mkg
2021-07-12 13:04:16 +08:00
parent ca92d949dd
commit 3b3eecc1d1
18 changed files with 181 additions and 484 deletions
+6 -2
View File
@@ -23,17 +23,21 @@ def main():
@admin_role.get('/data')
@authorize("admin:role:main", log=True)
def table():
# 获取请求参数
role_name = xss_escape(request.args.get('roleName', type=str))
role_code = xss_escape(request.args.get('roleCode', type=str))
# 查询参数构造
mf = ModelFilter()
if role_name:
mf.vague(field_name="name", value=role_name)
if role_code:
mf.vague(field_name="code", value=role_code)
# orm查询
# 使用分页获取data需要.items
role = Role.query.filter(mf.get_filter(Role)).layui_paginate()
count = Role.query.count()
data = model_to_dicts(Schema=RoleSchema, model=role.items)
return table_api(data=data, count=count)
# 返回api
return table_api(data=model_to_dicts(schema=RoleSchema, data=role.items), count=count)
# 角色增加