---
title: "创建角色"
method: POST
path: "/authority/createAuthority"
tags: ["Authority"]
---

# 创建角色

`POST /authority/createAuthority`

## Request body

- SystemSysAuthority
  - `authorityId` integer — 角色ID
  - `authorityName` string — 角色名
  - `children` SystemSysAuthority[]
  - `createdAt` string — 创建时间
  - `dataAuthorityId` SystemSysAuthority[]
  - `defaultRouter` string — 默认菜单(默认dashboard)
  - `deletedAt` string
  - `menus` SystemSysBaseMenu[]
    - `ID` integer — 主键ID
    - `authoritys` SystemSysAuthority[]
    - `children` SystemSysBaseMenu[]
    - `component` string — 对应前端文件路径
    - `createdAt` string — 创建时间
    - `hidden` boolean — 是否在列表隐藏
    - `menuBtn` SystemSysBaseMenuBtn[]
      - `ID` integer — 主键ID
      - `createdAt` string — 创建时间
      - `desc` string
      - `name` string
      - `sysBaseMenuID` integer
      - `updatedAt` string — 更新时间
    - `meta` SystemMeta
      - `activeName` string
      - `closeTab` boolean — 自动关闭tab
      - `defaultMenu` boolean — 是否是基础路由（开发中）
      - `icon` string — 菜单图标
      - `keepAlive` boolean — 是否缓存
      - `title` string — 菜单名
    - `name` string — 路由name
    - `parameters` SystemSysBaseMenuParameter[]
      - `ID` integer — 主键ID
      - `createdAt` string — 创建时间
      - `key` string — 地址栏携带参数的key
      - `sysBaseMenuID` integer
      - `type` string — 地址栏携带参数为params还是query
      - `updatedAt` string — 更新时间
      - `value` string — 地址栏携带参数的值
    - `parentId` integer — 父菜单ID
    - `path` string — 路由path
    - `sort` integer — 排序标记
    - `updatedAt` string — 更新时间
  - `parentId` integer — 父角色ID
  - `updatedAt` string — 更新时间

## Response `200`

创建角色,返回包括系统角色详情

- object
  - `code` integer
  - `data` ResponseSysAuthorityResponse
    - `authority` SystemSysAuthority
      - `authorityId` integer — 角色ID
      - `authorityName` string — 角色名
      - `children` SystemSysAuthority[]
      - `createdAt` string — 创建时间
      - `dataAuthorityId` SystemSysAuthority[]
      - `defaultRouter` string — 默认菜单(默认dashboard)
      - `deletedAt` string
      - `menus` SystemSysBaseMenu[]
        - `ID` integer — 主键ID
        - `authoritys` SystemSysAuthority[]
        - `children` SystemSysBaseMenu[]
        - `component` string — 对应前端文件路径
        - `createdAt` string — 创建时间
        - `hidden` boolean — 是否在列表隐藏
        - `menuBtn` SystemSysBaseMenuBtn[]
          - `ID` integer — 主键ID
          - `createdAt` string — 创建时间
          - `desc` string
          - `name` string
          - `sysBaseMenuID` integer
          - `updatedAt` string — 更新时间
        - `meta` SystemMeta
          - `activeName` string
          - `closeTab` boolean — 自动关闭tab
          - `defaultMenu` boolean — 是否是基础路由（开发中）
          - `icon` string — 菜单图标
          - `keepAlive` boolean — 是否缓存
          - `title` string — 菜单名
        - `name` string — 路由name
        - `parameters` SystemSysBaseMenuParameter[]
          - `ID` integer — 主键ID
          - `createdAt` string — 创建时间
          - `key` string — 地址栏携带参数的key
          - `sysBaseMenuID` integer
          - `type` string — 地址栏携带参数为params还是query
          - `updatedAt` string — 更新时间
          - `value` string — 地址栏携带参数的值
        - `parentId` integer — 父菜单ID
        - `path` string — 路由path
        - `sort` integer — 排序标记
        - `updatedAt` string — 更新时间
      - `parentId` integer — 父角色ID
      - `updatedAt` string — 更新时间
  - `msg` string

---

[API](https://skmtc.net/fisco-bcos/apis/gin-vue-admin-swagger-api.md) · [All operations](https://skmtc.net/fisco-bcos/apis/gin-vue-admin-swagger-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/fisco-bcos/gin-vue-admin-swagger-api/versions/83281ff551eb/schema)
