コード例 #1
0
async def V_MN_JOIN_SYS_PERMISSION_JOIN_SYS_ACTION_Query_Detail(request):
    """
    Description end-point
    ---
    description: V_MN_JOIN_SYS_PERMISSION_JOIN_SYS_ACTION明细查询
    tags:
    - select detail
    produces:
    - application/json
    parameters:
    - name: id
      in: query
      type: string
      required: true
      description: id 唯一标示符
    """
    id = request.query.get('id')
    try:
        if not id:
            tablelist = await V_MN_JOIN_SYS_PERMISSION_JOIN_SYS_ACTION.findAll(
                selectField='*')
        else:
            tablelist = await V_MN_JOIN_SYS_PERMISSION_JOIN_SYS_ACTION.findAll(
                selectField='*', where=f'id = "{id}"')
        data = dict(success=True, data=tablelist)
        return render_json(data)
    except Exception as e:
        data = dict(failure=True, data=e)
        return render_json(data)
コード例 #2
0
async def SYS_PERMISSION_InsOrUp(request):
    """
    Description end-point
    ---
    description: SYS_PERMISSION插入/更新 没有id表示插入 有id表示更新
    tags:
    - insert update
    produces:
    - application/json
    parameters:
    - in: body
      name: body
      description: SYS_PERMISSION插入/更新
      required: True
      schema:
        type: object
        properties:
          id:
            type: string
          createuserid:
            type: string
          updateuserid:
            type: string
          type:
            type: string
          remark:
            type: string
          
    """
    form = await request.json()
    id = form.get('id')
    createuserid = form.get('createuserid')
    updateuserid = form.get('updateuserid')
    type = form.get('type')
    remark = form.get('remark')

    try:
        if id:  # update
            effectrows = await SYS_PERMISSION(id=id).upd2(
                createuserid=createuserid,
                updateuserid=updateuserid,
                type=type,
                remark=remark,
            )
        elif not id:  # create
            id = next_id()
            effectrows = await SYS_PERMISSION().save2(
                id=id,
                createuserid=createuserid,
                updateuserid=updateuserid,
                type=type,
                remark=remark,
            )
        data = dict(success=True, data=(effectrows, id))
        return render_json(data)
    except Exception as e:
        logging.error(e)
        data = dict(failure=True, data=str(e))
        return render_json(data)
コード例 #3
0
ファイル: view_batch_ins.py プロジェクト: codezero00/web_Q
async def SYS_PERMISSION_BatchIns(request):
    """
    Description end-point
    ---
    description: SYS_PERMISSION批量插入
    tags:
    - insert batch
    produces:
    - application/json
    parameters:
    - in: body
      name: body
      description: SYS_PERMISSION插入/更新
      required: True
      schema:
        type: object
        properties:
          batch_data:
            type: array
            items:
              type: object
              properties:
                id:
                  type: string
                createuserid:
                  type: string
                createtime:
                  type: string
                updateuserid:
                  type: string
                updatetime:
                  type: string
                type:
                  type: string
                remark:
                  type: string
                
    """
    form = await request.json()
    data_list = form.get('batch_data')

    try:
        for n in data_list:
            effectrows = await SYS_PERMISSION(
                id=next_id(),
                createuserid=n.get('createuserid'),
                createtime=n.get('createtime'),
                updateuserid=n.get('updateuserid'),
                updatetime=n.get('updatetime'),
                type=n.get('type'),
                remark=n.get('remark'),
            ).save()

        data = dict(success=True, data=effectrows)
        return render_json(data)
    except Exception as e:
        logging.error(e)
        data = dict(failure=True, data=str(e))
        return render_json(data)
コード例 #4
0
ファイル: view_query_page.py プロジェクト: codezero00/web_Q
async def V_MULTIJOIN_USERS_ROLES_PERMISSION_MENU_ELEMENT_ACTION_Query_Page(
        request):
    """
    Description end-point
    ---
    description: V_MULTIJOIN_USERS_ROLES_PERMISSION_MENU_ELEMENT_ACTION分页查询
    tags:
    - select page
    produces:
    - application/json
    parameters:
    - name: CurrentPage
      in: query
      type: string
      required: true
      description: 当前页
    - name: PageSize
      in: query
      type: string
      required: true
      description: 每一页条数
    - name: Where
      in: query
      type: string
      description: where条件
    - name: OrderBy
      in: query
      type: string
      description: 排序
    """
    CurrentPage = request.query.get('CurrentPage')
    PageSize = request.query.get('PageSize')
    Where = request.query.get('Where')
    OrderBy = request.query.get('OrderBy')
    if (not CurrentPage or not PageSize):
        data = dict(failure=True,
                    data="find no parameters CurrentPage or PageSize !")
        return render_json(data)
    try:
        num = await V_MULTIJOIN_USERS_ROLES_PERMISSION_MENU_ELEMENT_ACTION.findNumber(
            selectField='count(*)', where=Where)
        p = Page(num, int(CurrentPage),
                 int(PageSize))  # totalcount  # currentpage  # pagesize
        if num == 0:
            data1 = dict(page=p.GetDict, res=[])
        else:
            list = await V_MULTIJOIN_USERS_ROLES_PERMISSION_MENU_ELEMENT_ACTION.findAll(
                selectField='*',
                where=Where,
                orderBy=OrderBy,
                limit=(p.offset, p.limit))
            data1 = dict(page=p.GetDict, res=list)
        data = dict(success=True, data=data1)
        return render_json(data)
    except Exception as e:
        data = dict(failure=True, data=e)
        return render_json(data)
コード例 #5
0
async def SYS_USER_GROUP_HAS_SYS_ROLES_InsOrUp(request):
    """
    Description end-point
    ---
    description: SYS_USER_GROUP_HAS_SYS_ROLES插入/更新 没有id表示插入 有id表示更新
    tags:
    - insert update
    produces:
    - application/json
    parameters:
    - in: body
      name: body
      description: SYS_USER_GROUP_HAS_SYS_ROLES插入/更新
      required: True
      schema:
        type: object
        properties:
          id:
            type: string
          sys_user_group_id:
            type: string
          sys_roles_id:
            type: string
          
    """
    form = await request.json()
    id = form.get('id')
    sys_user_group_id = form.get('sys_user_group_id')
    sys_roles_id = form.get('sys_roles_id')

    try:
        if id:  # update
            effectrows = await SYS_USER_GROUP_HAS_SYS_ROLES(id=id).upd2(
                sys_user_group_id=sys_user_group_id,
                sys_roles_id=sys_roles_id,
            )
        elif not id:  # create
            id = next_id()
            effectrows = await SYS_USER_GROUP_HAS_SYS_ROLES().save2(
                id=id,
                sys_user_group_id=sys_user_group_id,
                sys_roles_id=sys_roles_id,
            )
        data = dict(success=True, data=(effectrows, id))
        return render_json(data)
    except Exception as e:
        logging.error(e)
        data = dict(failure=True, data=str(e))
        return render_json(data)
コード例 #6
0
ファイル: view_batch_ins.py プロジェクト: codezero00/web_Q
async def SYS_USERS_HAS_SYS_ORGANIZATION_BatchIns(request):
    """
    Description end-point
    ---
    description: SYS_USERS_HAS_SYS_ORGANIZATION批量插入
    tags:
    - insert batch
    produces:
    - application/json
    parameters:
    - in: body
      name: body
      description: SYS_USERS_HAS_SYS_ORGANIZATION插入/更新
      required: True
      schema:
        type: object
        properties:
          batch_data:
            type: array
            items:
              type: object
              properties:
                id:
                  type: string
                sys_users_id:
                  type: string
                sys_organization_id:
                  type: string
                
    """
    form = await request.json()
    data_list = form.get('batch_data')

    try:
        for n in data_list:
            effectrows = await SYS_USERS_HAS_SYS_ORGANIZATION(
                id=next_id(),
                sys_users_id=n.get('sys_users_id'),
                sys_organization_id=n.get('sys_organization_id'),
            ).save()

        data = dict(success=True, data=effectrows)
        return render_json(data)
    except Exception as e:
        logging.error(e)
        data = dict(failure=True, data=str(e))
        return render_json(data)
コード例 #7
0
async def SYS_ACTION_BatchDel(request):
    """
    Description end-point
    ---
    description: SYS_ACTION批量删除
    tags:
    - batch delete
    produces:
    - application/json
    parameters:
    - in: body
      name: body
      description: SYS_ACTION批量删除
      required: True
      schema:
        type: object
        properties:
          batchid:
            type: string
            description: ['xxx','xxx','xxx',...]
    """
    form = await request.json()
    batchid = form.get('batchid')
    x = re.search(r'^\[(.*?)\]$', str(batchid))
    try:
        sql = f'delete from sys_action where id in ({x.group(1)})'

        print(sql)
        effectrows = await orm.execute(sql=sql, args=())
        logging.info(effectrows)
        data = dict(success=True, data=effectrows)
        return render_json(data)
    except Exception as e:
        logging.error(e)
        data = dict(failure=True, data=str(e))
        return render_json(data)
コード例 #8
0
async def SYS_USERS_InsOrUp(request):
    """
    Description end-point
    ---
    description: SYS_USERS插入/更新 没有id表示插入 有id表示更新
    tags:
    - insert update
    produces:
    - application/json
    parameters:
    - in: body
      name: body
      description: SYS_USERS插入/更新
      required: True
      schema:
        type: object
        properties:
          id:
            type: string
          createuserid:
            type: string
          updateuserid:
            type: string
          name:
            type: string
          sex:
            type: string
          job:
            type: string
          tel:
            type: string
          account:
            type: string
          expiredtime:
            type: string
          oauth2_id:
            type: string
          
    """
    form = await request.json()
    id = form.get('id')
    createuserid = form.get('createuserid')
    updateuserid = form.get('updateuserid')
    name = form.get('name')
    sex = form.get('sex')
    job = form.get('job')
    tel = form.get('tel')
    account = form.get('account')
    expiredtime = form.get('expiredtime')
    oauth2_id = form.get('oauth2_id')

    try:
        if id:  # update
            effectrows = await SYS_USERS(id=id).upd2(
                createuserid=createuserid,
                updateuserid=updateuserid,
                name=name,
                sex=sex,
                job=job,
                tel=tel,
                account=account,
                expiredtime=expiredtime,
                oauth2_id=oauth2_id,
            )
        elif not id:  # create
            id = next_id()
            effectrows = await SYS_USERS().save2(
                id=id,
                createuserid=createuserid,
                updateuserid=updateuserid,
                name=name,
                sex=sex,
                job=job,
                tel=tel,
                account=account,
                expiredtime=expiredtime,
                oauth2_id=oauth2_id,
            )
        data = dict(success=True, data=(effectrows, id))
        return render_json(data)
    except Exception as e:
        logging.error(e)
        data = dict(failure=True, data=str(e))
        return render_json(data)
コード例 #9
0
async def SYS_DICT_InsOrUp(request):
    """
    Description end-point
    ---
    description: SYS_DICT插入/更新 没有id表示插入 有id表示更新
    tags:
    - insert update
    produces:
    - application/json
    parameters:
    - in: body
      name: body
      description: SYS_DICT插入/更新
      required: True
      schema:
        type: object
        properties:
          id:
            type: string
          createuserid:
            type: string
          updateuserid:
            type: string
          code:
            type: string
          name:
            type: string
          level:
            type: string
          remark:
            type: string
          sort:
            type: string
          pid:
            type: string
          
    """
    form = await request.json()
    id = form.get('id')
    createuserid = form.get('createuserid')
    updateuserid = form.get('updateuserid')
    code = form.get('code')
    name = form.get('name')
    level = form.get('level')
    remark = form.get('remark')
    sort = form.get('sort')
    pid = form.get('pid')

    try:
        if id:  # update
            effectrows = await SYS_DICT(id=id).upd2(
                createuserid=createuserid,
                updateuserid=updateuserid,
                code=code,
                name=name,
                level=level,
                remark=remark,
                sort=sort,
                pid=pid,
            )
        elif not id:  # create
            id = next_id()
            effectrows = await SYS_DICT().save2(
                id=id,
                createuserid=createuserid,
                updateuserid=updateuserid,
                code=code,
                name=name,
                level=level,
                remark=remark,
                sort=sort,
                pid=pid,
            )
        data = dict(success=True, data=(effectrows, id))
        return render_json(data)
    except Exception as e:
        logging.error(e)
        data = dict(failure=True, data=str(e))
        return render_json(data)
コード例 #10
0
async def SYS_ORGANIZATION_InsOrUp(request):
    """
    Description end-point
    ---
    description: SYS_ORGANIZATION插入/更新 没有id表示插入 有id表示更新
    tags:
    - insert update
    produces:
    - application/json
    parameters:
    - in: body
      name: body
      description: SYS_ORGANIZATION插入/更新
      required: True
      schema:
        type: object
        properties:
          id:
            type: string
          createuserid:
            type: string
          updateuserid:
            type: string
          code:
            type: string
          name:
            type: string
          fullname:
            type: string
          location:
            type: string
          x:
            type: string
          y:
            type: string
          remark:
            type: string
          isvalid:
            type: string
          pid:
            type: string
          
    """
    form = await request.json()
    id = form.get('id')
    createuserid = form.get('createuserid')
    updateuserid = form.get('updateuserid')
    code = form.get('code')
    name = form.get('name')
    fullname = form.get('fullname')
    location = form.get('location')
    x = form.get('x')
    y = form.get('y')
    remark = form.get('remark')
    isvalid = form.get('isvalid')
    pid = form.get('pid')

    try:
        if id:  # update
            effectrows = await SYS_ORGANIZATION(id=id).upd2(
                createuserid=createuserid,
                updateuserid=updateuserid,
                code=code,
                name=name,
                fullname=fullname,
                location=location,
                x=x,
                y=y,
                remark=remark,
                isvalid=isvalid,
                pid=pid,
            )
        elif not id:  # create
            id = next_id()
            effectrows = await SYS_ORGANIZATION().save2(
                id=id,
                createuserid=createuserid,
                updateuserid=updateuserid,
                code=code,
                name=name,
                fullname=fullname,
                location=location,
                x=x,
                y=y,
                remark=remark,
                isvalid=isvalid,
                pid=pid,
            )
        data = dict(success=True, data=(effectrows, id))
        return render_json(data)
    except Exception as e:
        logging.error(e)
        data = dict(failure=True, data=str(e))
        return render_json(data)
コード例 #11
0
async def SYS_MENU_InsOrUp(request):
    """
    Description end-point
    ---
    description: SYS_MENU插入/更新 没有id表示插入 有id表示更新
    tags:
    - insert update
    produces:
    - application/json
    parameters:
    - in: body
      name: body
      description: SYS_MENU插入/更新
      required: True
      schema:
        type: object
        properties:
          id:
            type: string
          createuserid:
            type: string
          updateuserid:
            type: string
          namezh:
            type: string
          name:
            type: string
          path:
            type: string
          component:
            type: string
          title:
            type: string
          icon:
            type: string
          level:
            type: string
          pid:
            type: string
          
    """
    form = await request.json()
    id = form.get('id')
    createuserid = form.get('createuserid')
    updateuserid = form.get('updateuserid')
    namezh = form.get('namezh')
    name = form.get('name')
    path = form.get('path')
    component = form.get('component')
    title = form.get('title')
    icon = form.get('icon')
    level = form.get('level')
    pid = form.get('pid')

    try:
        if id:  # update
            effectrows = await SYS_MENU(id=id).upd2(
                createuserid=createuserid,
                updateuserid=updateuserid,
                namezh=namezh,
                name=name,
                path=path,
                component=component,
                title=title,
                icon=icon,
                level=level,
                pid=pid,
            )
        elif not id:  # create
            id = next_id()
            effectrows = await SYS_MENU().save2(
                id=id,
                createuserid=createuserid,
                updateuserid=updateuserid,
                namezh=namezh,
                name=name,
                path=path,
                component=component,
                title=title,
                icon=icon,
                level=level,
                pid=pid,
            )
        data = dict(success=True, data=(effectrows, id))
        return render_json(data)
    except Exception as e:
        logging.error(e)
        data = dict(failure=True, data=str(e))
        return render_json(data)
コード例 #12
0
async def SYS_ELEMENT_InsOrUp(request):
    """
    Description end-point
    ---
    description: SYS_ELEMENT插入/更新 没有id表示插入 有id表示更新
    tags:
    - insert update
    produces:
    - application/json
    parameters:
    - in: body
      name: body
      description: SYS_ELEMENT插入/更新
      required: True
      schema:
        type: object
        properties:
          id:
            type: string
          createuserid:
            type: string
          updateuserid:
            type: string
          name:
            type: string
          value:
            type: string
          menu_id:
            type: string
          
    """
    form = await request.json()
    id = form.get('id')
    createuserid = form.get('createuserid')
    updateuserid = form.get('updateuserid')
    name = form.get('name')
    value = form.get('value')
    menu_id = form.get('menu_id')

    try:
        if id:  # update
            effectrows = await SYS_ELEMENT(id=id).upd2(
                createuserid=createuserid,
                updateuserid=updateuserid,
                name=name,
                value=value,
                menu_id=menu_id,
            )
        elif not id:  # create
            id = next_id()
            effectrows = await SYS_ELEMENT().save2(
                id=id,
                createuserid=createuserid,
                updateuserid=updateuserid,
                name=name,
                value=value,
                menu_id=menu_id,
            )
        data = dict(success=True, data=(effectrows, id))
        return render_json(data)
    except Exception as e:
        logging.error(e)
        data = dict(failure=True, data=str(e))
        return render_json(data)
コード例 #13
0
ファイル: view_batch_ins.py プロジェクト: codezero00/web_Q
async def SYS_USERS_BatchIns(request):
    """
    Description end-point
    ---
    description: SYS_USERS批量插入
    tags:
    - insert batch
    produces:
    - application/json
    parameters:
    - in: body
      name: body
      description: SYS_USERS插入/更新
      required: True
      schema:
        type: object
        properties:
          batch_data:
            type: array
            items:
              type: object
              properties:
                id:
                  type: string
                createuserid:
                  type: string
                createtime:
                  type: string
                updateuserid:
                  type: string
                updatetime:
                  type: string
                name:
                  type: string
                sex:
                  type: string
                job:
                  type: string
                tel:
                  type: string
                account:
                  type: string
                expiredtime:
                  type: string
                oauth2_id:
                  type: string
                
    """
    form = await request.json()
    data_list = form.get('batch_data')

    try:
        for n in data_list:
            effectrows = await SYS_USERS(
                id=next_id(),
                createuserid=n.get('createuserid'),
                createtime=n.get('createtime'),
                updateuserid=n.get('updateuserid'),
                updatetime=n.get('updatetime'),
                name=n.get('name'),
                sex=n.get('sex'),
                job=n.get('job'),
                tel=n.get('tel'),
                account=n.get('account'),
                expiredtime=n.get('expiredtime'),
                oauth2_id=n.get('oauth2_id'),
            ).save()

        data = dict(success=True, data=effectrows)
        return render_json(data)
    except Exception as e:
        logging.error(e)
        data = dict(failure=True, data=str(e))
        return render_json(data)
コード例 #14
0
ファイル: view_batch_ins.py プロジェクト: codezero00/web_Q
async def SYS_MENU_BatchIns(request):
    """
    Description end-point
    ---
    description: SYS_MENU批量插入
    tags:
    - insert batch
    produces:
    - application/json
    parameters:
    - in: body
      name: body
      description: SYS_MENU插入/更新
      required: True
      schema:
        type: object
        properties:
          batch_data:
            type: array
            items:
              type: object
              properties:
                id:
                  type: string
                createuserid:
                  type: string
                createtime:
                  type: string
                updateuserid:
                  type: string
                updatetime:
                  type: string
                namezh:
                  type: string
                name:
                  type: string
                path:
                  type: string
                component:
                  type: string
                title:
                  type: string
                icon:
                  type: string
                level:
                  type: string
                pid:
                  type: string
                
    """
    form = await request.json()
    data_list = form.get('batch_data')

    try:
        for n in data_list:
            effectrows = await SYS_MENU(
                id=next_id(),
                createuserid=n.get('createuserid'),
                createtime=n.get('createtime'),
                updateuserid=n.get('updateuserid'),
                updatetime=n.get('updatetime'),
                namezh=n.get('namezh'),
                name=n.get('name'),
                path=n.get('path'),
                component=n.get('component'),
                title=n.get('title'),
                icon=n.get('icon'),
                level=n.get('level'),
                pid=n.get('pid'),
            ).save()

        data = dict(success=True, data=effectrows)
        return render_json(data)
    except Exception as e:
        logging.error(e)
        data = dict(failure=True, data=str(e))
        return render_json(data)