Files
K12Study/docs/apijson/upms.api.json
2026-04-16 18:12:09 +08:00

270 lines
8.5 KiB
JSON

{
"_meta": {
"module": "upms",
"prefix": "/api/upms",
"responseEnvelope": {
"code": "int, 0=成功, 非0=业务失败",
"message": "string, 业务描述",
"data": "T, 业务数据",
"traceId": "string, 链路追踪ID"
},
"errorExample": {
"code": 500,
"message": "系统异常",
"data": null,
"traceId": "abc123"
}
},
"apis": [
{
"id": "upms-routes",
"method": "GET",
"path": "/api/upms/routes",
"summary": "获取当前用户的动态路由/菜单树",
"sqlSource": "upms.tb_sys_menu + upms.tb_sys_role_menu",
"request": {
"headers": { "Authorization": "Bearer {accessToken}" },
"params": null,
"body": null
},
"response": {
"code": 0,
"message": "OK",
"data": [
{
"id": "dashboard",
"path": "/",
"name": "dashboard",
"component": "dashboard",
"layout": "SIDEBAR",
"meta": {
"title": "控制台",
"icon": "layout-dashboard",
"permissionCodes": ["dashboard:view"],
"hidden": false
},
"children": []
},
{
"id": "tenant-management",
"path": "/tenant",
"name": "tenant-management",
"component": "tenant",
"layout": "SIDEBAR",
"meta": {
"title": "租户组织",
"icon": "building-2",
"permissionCodes": ["tenant:view"],
"hidden": false
},
"children": []
}
],
"traceId": "trace-001"
},
"fieldMapping": {
"id": "tb_sys_menu.route_id",
"path": "tb_sys_menu.route_path",
"name": "tb_sys_menu.route_name",
"component": "tb_sys_menu.component_key",
"layout": "tb_sys_menu.layout_type",
"meta.title": "tb_sys_menu.title",
"meta.icon": "tb_sys_menu.icon",
"meta.permissionCodes": "tb_sys_menu.permission_code (拆分为数组)",
"meta.hidden": "tb_sys_menu.hidden",
"children": "通过 parent_route_id 递归组装"
},
"backendDto": "com.k12study.api.upms.dto.RouteNodeDto",
"frontendType": "UpmsRouteNode (types/upms.ts)"
},
{
"id": "upms-users-current",
"method": "GET",
"path": "/api/upms/users/current",
"summary": "获取当前登录用户信息(含权限编码)",
"sqlSource": "upms.tb_sys_user + upms.tb_sys_role + upms.tb_sys_role_menu",
"request": {
"headers": { "Authorization": "Bearer {accessToken}" },
"params": null,
"body": null
},
"response": {
"code": 0,
"message": "OK",
"data": {
"userId": "U10001",
"username": "admin",
"displayName": "K12Study 管理员",
"adcode": "330100",
"tenantId": "SCH-HQ",
"tenantPath": "/SCH-HQ/",
"deptId": "DEPT-HQ-ADMIN",
"deptPath": "/DEPT-HQ/DEPT-HQ-ADMIN/",
"permissionCodes": ["dashboard:view", "tenant:view", "dept:view"]
},
"traceId": "trace-002"
},
"fieldMapping": {
"userId": "tb_sys_user.user_id",
"username": "tb_sys_user.username",
"displayName": "tb_sys_user.display_name",
"adcode": "tb_sys_user.adcode",
"tenantId": "tb_sys_user.tenant_id",
"tenantPath": "tb_sys_user.tenant_path",
"deptId": "tb_sys_user.dept_id",
"deptPath": "tb_sys_user.dept_path",
"permissionCodes": "通过 role->role_menu->menu.permission_code 聚合"
},
"backendDto": "com.k12study.api.upms.dto.CurrentRouteUserDto",
"frontendType": "UpmsCurrentUser (types/upms.ts)"
},
{
"id": "upms-areas",
"method": "GET",
"path": "/api/upms/areas",
"summary": "获取行政区划树",
"sqlSource": "upms.tb_sys_area",
"request": {
"headers": { "Authorization": "Bearer {accessToken}" },
"params": null,
"body": null
},
"response": {
"code": 0,
"message": "OK",
"data": [
{
"areaCode": "330000",
"parentCode": "100000",
"areaName": "浙江省",
"areaLevel": "PROVINCE",
"children": [
{
"areaCode": "330100",
"parentCode": "330000",
"areaName": "杭州市",
"areaLevel": "CITY",
"children": []
}
]
}
],
"traceId": "trace-003"
},
"fieldMapping": {
"areaCode": "tb_sys_area.adcode (转为字符串)",
"parentCode": "tb_sys_area.pid (转为字符串)",
"areaName": "tb_sys_area.name",
"areaLevel": "tb_sys_area.area_type (映射: 0->COUNTRY, 1->PROVINCE, 2->CITY)",
"children": "通过 pid 递归组装"
},
"backendDto": "com.k12study.api.upms.dto.AreaNodeDto",
"frontendType": "UpmsAreaNode (types/upms.ts)"
},
{
"id": "upms-tenants",
"method": "GET",
"path": "/api/upms/tenants",
"summary": "获取租户树",
"sqlSource": "upms.tb_sys_tenant",
"request": {
"headers": { "Authorization": "Bearer {accessToken}" },
"params": null,
"body": null
},
"response": {
"code": 0,
"message": "OK",
"data": [
{
"tenantId": "SCH-HQ",
"parentTenantId": null,
"tenantName": "K12Study 总校",
"tenantType": "HEAD_SCHOOL",
"adcode": "330100",
"tenantPath": "/SCH-HQ/",
"children": [
{
"tenantId": "SCH-ZJ-HZ-01",
"parentTenantId": "SCH-HQ",
"tenantName": "杭州分校",
"tenantType": "CITY_SCHOOL",
"adcode": "330100",
"tenantPath": "/SCH-HQ/SCH-ZJ-HZ-01/",
"children": []
}
]
}
],
"traceId": "trace-004"
},
"fieldMapping": {
"tenantId": "tb_sys_tenant.tenant_id",
"parentTenantId": "tb_sys_tenant.parent_tenant_id",
"tenantName": "tb_sys_tenant.tenant_name",
"tenantType": "tb_sys_tenant.tenant_type",
"adcode": "tb_sys_tenant.adcode",
"tenantPath": "tb_sys_tenant.tenant_path",
"children": "通过 parent_tenant_id 递归组装"
},
"backendDto": "com.k12study.api.upms.dto.TenantNodeDto",
"frontendType": "UpmsTenantNode (types/upms.ts)"
},
{
"id": "upms-departments",
"method": "GET",
"path": "/api/upms/departments",
"summary": "获取部门/组织树",
"sqlSource": "upms.tb_sys_dept",
"request": {
"headers": { "Authorization": "Bearer {accessToken}" },
"params": null,
"body": null
},
"response": {
"code": 0,
"message": "OK",
"data": [
{
"deptId": "DEPT-HQ",
"parentDeptId": null,
"deptName": "总校教学部",
"deptType": "GRADE",
"tenantId": "SCH-HQ",
"adcode": "330100",
"tenantPath": "/SCH-HQ/",
"deptPath": "/DEPT-HQ/",
"children": [
{
"deptId": "DEPT-HQ-MATH",
"parentDeptId": "DEPT-HQ",
"deptName": "数学学科组",
"deptType": "SUBJECT",
"tenantId": "SCH-HQ",
"adcode": "330100",
"tenantPath": "/SCH-HQ/",
"deptPath": "/DEPT-HQ/DEPT-HQ-MATH/",
"children": []
}
]
}
],
"traceId": "trace-005"
},
"fieldMapping": {
"deptId": "tb_sys_dept.dept_id",
"parentDeptId": "tb_sys_dept.parent_dept_id",
"deptName": "tb_sys_dept.dept_name",
"deptType": "tb_sys_dept.dept_type",
"tenantId": "tb_sys_dept.tenant_id",
"adcode": "tb_sys_dept.adcode",
"tenantPath": "tb_sys_dept.tenant_path",
"deptPath": "tb_sys_dept.dept_path",
"children": "通过 parent_dept_id 递归组装"
},
"backendDto": "com.k12study.api.upms.dto.DeptNodeDto",
"frontendType": "UpmsDeptNode (types/upms.ts)"
}
]
}