예제 #1
0
def operate_log():
    # orm查询
    # 使用分页获取data需要.items
    log = AdminLog.query.filter(AdminLog.url != '/passport/login').order_by(
        desc(AdminLog.create_time)).layui_paginate()
    count = log.total
    return table_api(data=model_to_dicts(schema=LogOutSchema, data=log.items),
                     count=count)
예제 #2
0
def dict_type_data():
    # 获取请求参数
    type_name = xss_escape(request.args.get('typeName', type=str))
    # 查询参数构造
    mf = ModelFilter()
    if type_name:
        mf.vague(field_name="type_name", value=type_name)
    # orm查询
    # 使用分页获取data需要.items
    dict_all = DictType.query.filter(mf.get_filter(DictType)).layui_paginate()
    count = dict_all.total
    data = curd.model_to_dicts(schema=DictTypeOutSchema, data=dict_all.items)
    return table_api(data=data, count=count)
예제 #3
0
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.total
    # 返回api
    return table_api(data=model_to_dicts(schema=RoleOutSchema,
                                         data=role.items),
                     count=count)
예제 #4
0
def data():
    # 获取请求参数
    real_name = xss_escape(request.args.get('realName', type=str))
    username = xss_escape(request.args.get('username', type=str))
    dept_id = request.args.get('deptId', type=int)
    # 查询参数构造
    mf = ModelFilter()
    if real_name:
        mf.contains(field_name="realname", value=real_name)
    if username:
        mf.contains(field_name="username", value=username)
    if dept_id:
        mf.exact(field_name="dept_id", value=dept_id)
    # orm查询
    # 使用分页获取data需要.items
    user = User.query.filter(mf.get_filter(model=User)).layui_paginate()
    count = user.total
    # 返回api
    return table_api(data=model_to_dicts(schema=UserOutSchema,
                                         data=user.items),
                     count=count)
예제 #5
0
def get_task():  # 获取
    jobs = scheduler.get_jobs()
    jobs_list = []
    for job in jobs:
        jobs_list.append(job_to_dict(job))
    return table_api(data=jobs_list, count=len(jobs_list))
예제 #6
0
def dict_code_data():
    type_code = xss_escape(request.args.get('typeCode', type=str))
    dict_data = DictData.query.filter_by(type_code=type_code).layui_paginate()
    count = dict_data.total
    data = curd.model_to_dicts(schema=DictDataOutSchema, data=dict_data.items)
    return table_api(data=data, count=count)
예제 #7
0
def table():
    page = request.args.get('page', type=int)
    limit = request.args.get('limit', type=int)
    data, count = upload_curd.get_photo(page=page, limit=limit)
    return table_api(data=data, count=count)