meta { name: 复制角色 type: http seq: 8 tags: [ generated ] } post { url: {{baseUrl}}/api/roles/copy body: formUrlEncoded auth: inherit } body:form-urlencoded { id: 3 } docs { # 复制角色 `POST /api/roles/copy` 复制角色(停用草稿,不复制人员):产出 status=disabled 的停用草稿,功能权限/数据范围全随源角色。 ## 请求参数 | 参数 | 类型 | 必填 | 默认 | 说明 | | --- | --- | --- | --- | --- | | id | string | 是 | - | 源角色 ID | ## 请求示例 请求头:Authorization: Bearer {{token}} Content-Type: application/x-www-form-urlencoded POST /api/roles/copy id=3 ## 响应 data 结构 | 字段 | 类型 | 说明 | | --- | --- | --- | | id | string | 新角色 ID(Long 序列化为 string) | | createTime | string | 创建时间 | | updateTime | string | 更新时间 | | roleName | string | 角色名称 | | roleCode | string | 角色编码(草稿由服务生成) | | sort | int | 排序 | | remark | string | 备注 | | builtin | boolean | 是否内置角色 | | roleType | string | 角色类型 code:SYS/MANAGE/BIZ/FUNC | | status | string | 状态 enabled/disabled(复制产出停用草稿:disabled) | | userCount | long | 在职使用人数(仅出参,草稿为 0) | | resourceIds | array | 已补全祖先的完整授权集合(全随源角色) | | moduleScopes | array | 角色×模块数据范围档位列表(仅 detail 出参填充) | ## 响应示例 // 示例数据,字段结构以上表为准,非真实返回 ```json { "code": 0, "success": true, "message": "success", "data": { "id": "20", "createTime": "2026-09-07 10:00:00", "updateTime": "2026-09-07 10:00:00", "roleName": "销售-副本", "roleCode": "ROLE_SALES_COPY_1", "sort": 1, "remark": "一线销售", "builtin": false, "roleType": "BIZ", "status": "disabled", "userCount": 0, "resourceIds": ["1", "2", "5"], "moduleScopes": null } } ``` }