### Clone and Run RuoYi-Vue Project Locally Source: https://github.com/yangzongzhuan/ruoyi-vue/blob/master/ruoyi-ui/README.md This snippet details the process of cloning the RuoYi-Vue project from its repository, navigating into the project directory, installing necessary dependencies using npm, and starting the development server. It also provides a workaround for slow npm download speeds and the URL to access the application in a browser. ```bash # 克隆项目 git clone https://gitee.com/y_project/RuoYi-Vue # 进入项目目录 cd ruoyi-ui # 安装依赖 npm install # 建议不要直接使用 cnpm 安装依赖,会有各种诡异的 bug。可以通过如下操作解决 npm 下载速度慢的问题 npm install --registry=https://registry.npmmirror.com # 启动服务 npm run dev 浏览器访问 http://localhost:80 ``` -------------------------------- ### Get Parameter by Key (Bash) Source: https://context7.com/yangzongzhuan/ruoyi-vue/llms.txt Retrieves the value of a system configuration parameter using its key. Requires an Authorization header. ```bash # 根据参数键名查询 curl -X GET "http://localhost:8080/system/config/configKey/sys.account.registerUser" \ -H "Authorization: Bearer eyJhbGciOiJIUzUxMiJ9..." # 响应示例 { "code": 200, "msg": "操作成功", "data": "true" } ``` -------------------------------- ### Get Menu List (Bash) Source: https://context7.com/yangzongzhuan/ruoyi-vue/llms.txt Retrieves a list of all system menus, including directories, menus, and buttons, presented in a tree structure. Requires an authentication token. ```bash # 获取菜单列表 curl -X GET "http://localhost:8080/system/menu/list" \ -H "Authorization: Bearer eyJhbGciOiJIUzUxMiJ9..." # 响应示例 { "code": 200, "msg": "操作成功", "data": [ { "menuId": 1, "menuName": "系统管理", "parentId": 0, "orderNum": 1, "path": "system", "component": null, "menuType": "M", "visible": "0", "status": "0", "perms": "", "icon": "system" } ] } ``` -------------------------------- ### Build RuoYi-Vue Project for Staging and Production Source: https://github.com/yangzongzhuan/ruoyi-vue/blob/master/ruoyi-ui/README.md This section provides the commands to build the RuoYi-Vue project for different environments. It includes instructions for creating a build for the staging environment and a separate build for the production environment. ```bash # 构建测试环境 npm run build:stage # 构建生产环境 npm run build:prod ``` -------------------------------- ### Get Role List (Bash) Source: https://context7.com/yangzongzhuan/ruoyi-vue/llms.txt Retrieves a paginated list of roles. Supports filtering by role name, permissions, and status. Requires an authentication token. ```bash # 获取角色列表 curl -X GET "http://localhost:8080/system/role/list?pageNum=1&pageSize=10" \ -H "Authorization: Bearer eyJhbGciOiJIUzUxMiJ9..." # 响应示例 { "code": 200, "msg": "查询成功", "total": 2, "rows": [ { "roleId": 1, "roleName": "超级管理员", "roleKey": "admin", "roleSort": 1, "dataScope": "1", "status": "0" }, { "roleId": 2, "roleName": "普通角色", "roleKey": "common", "roleSort": 2, "dataScope": "2", "status": "0" } ] } ``` -------------------------------- ### Get Department List (Bash) Source: https://context7.com/yangzongzhuan/ruoyi-vue/llms.txt Fetches a list of departments in a tree structure. Requires an authentication token. ```bash # 获取部门列表 curl -X GET "http://localhost:8080/system/dept/list" \ -H "Authorization: Bearer eyJhbGciOiJIUzUxMiJ9..." # 响应示例 { "code": 200, "msg": "操作成功", "data": [ { "deptId": 100, "parentId": 0, "deptName": "若依科技", "orderNum": 0, "leader": "若依", "status": "0", "children": [ { "deptId": 101, "parentId": 100, "deptName": "深圳总公司", "orderNum": 1, "status": "0" } ] } ] } ``` -------------------------------- ### Get User Profile (Bash) Source: https://context7.com/yangzongzhuan/ruoyi-vue/llms.txt Fetches the detailed information of the currently logged-in user, including their role and post groups. Requires an Authorization header. ```bash # 获取个人信息 curl -X GET "http://localhost:8080/system/user/profile" \ -H "Authorization: Bearer eyJhbGciOiJIUzUxMiJ9..." # 响应示例 { "code": 200, "msg": "操作成功", "data": { "userId": 1, "userName": "admin", "nickName": "管理员", "email": "admin@ruoyi.vip", "phonenumber": "15888888888" }, "roleGroup": "超级管理员", "postGroup": "董事长" } ``` -------------------------------- ### Get User List (Bash) Source: https://context7.com/yangzongzhuan/ruoyi-vue/llms.txt Performs a paginated query for the user list, supporting filtering by username, phone number, status, and department. Requires the `system:user:list` permission. ```bash curl -X GET "http://localhost:8080/system/user/list?pageNum=1&pageSize=10&userName=admin" \ -H "Authorization: Bearer eyJhbGciOiJIUzUxMiJ9..." ``` -------------------------------- ### Get User Info (Bash) Source: https://context7.com/yangzongzhuan/ruoyi-vue/llms.txt Fetches detailed information about the currently logged-in user, including their roles and permissions. Requires a valid JWT Token in the request header for authentication. ```bash curl -X GET "http://localhost:8080/getInfo" \ -H "Authorization: Bearer eyJhbGciOiJIUzUxMiJ9..." ``` -------------------------------- ### Get Role Menu Tree (Bash) Source: https://context7.com/yangzongzhuan/ruoyi-vue/llms.txt Retrieves the menu tree for a specific role, indicating pre-selected menus for authorization purposes. Requires the role ID and an authentication token. ```bash # 获取角色菜单树 curl -X GET "http://localhost:8080/system/menu/roleMenuTreeselect/2" \ -H "Authorization: Bearer eyJhbGciOiJIUzUxMiJ9..." # 响应示例 { "code": 200, "msg": "操作成功", "checkedKeys": [1, 100, 101, 102], "menus": [ { "id": 1, "label": "系统管理", "children": [ { "id": 100, "label": "用户管理" }, { "id": 101, "label": "角色管理" } ] } ] } ``` -------------------------------- ### Get Routers (Bash) Source: https://context7.com/yangzongzhuan/ruoyi-vue/llms.txt Retrieves the frontend routing menu based on the user's roles, dynamically generating a list of accessible menus. The frontend uses this data to render the sidebar navigation. ```bash curl -X GET "http://localhost:8080/getRouters" \ -H "Authorization: Bearer eyJhbGciOiJIUzUxMiJ9..." ``` -------------------------------- ### Get Dict Data by Type (Bash) Source: https://context7.com/yangzongzhuan/ruoyi-vue/llms.txt Queries dictionary data based on a dictionary type code. Commonly used for populating dropdowns. Requires the dictionary type and an authentication token. ```bash # 根据字典类型查询数据 curl -X GET "http://localhost:8080/system/dict/data/type/sys_user_sex" \ -H "Authorization: Bearer eyJhbGciOiJIUzUxMiJ9..." ``` -------------------------------- ### Get Captcha Image (Bash) Source: https://context7.com/yangzongzhuan/ruoyi-vue/llms.txt Retrieves a graphical CAPTCHA image for login verification. Returns a Base64 encoded image and a UUID. Supports configurable CAPTCHA types (mathematical or character-based). ```bash curl -X GET "http://localhost:8080/captchaImage" ``` -------------------------------- ### User Registration (Bash) Source: https://context7.com/yangzongzhuan/ruoyi-vue/llms.txt Allows new users to register. This functionality is only available if the system's registration feature is enabled via the `sys.account.registerUser` configuration setting. ```bash curl -X POST "http://localhost:8080/register" \ -H "Content-Type: application/json" \ -d '{ "username": "testuser", "password": "Test@123456", "code": "5", "uuid": "abc123def456" }' ``` -------------------------------- ### Add Menu (Bash) Source: https://context7.com/yangzongzhuan/ruoyi-vue/llms.txt Creates a new menu item, supporting directory (M), menu (C), and button (F) types. Requires parent ID, menu details, and an authentication token. ```bash # 新增菜单(menuType: M-目录, C-菜单, F-按钮) curl -X POST "http://localhost:8080/system/menu" \ -H "Authorization: Bearer eyJhbGciOiJIUzUxMiJ9..." \ -H "Content-Type: application/json" \ -d '{ "parentId": 1, "menuType": "C", "menuName": "测试菜单", "orderNum": 10, "path": "test", "component": "system/test/index", "perms": "system:test:list", "icon": "edit", "visible": "0", "status": "0" }' # 响应示例 { "code": 200, "msg": "操作成功" } ``` -------------------------------- ### Add User (Bash) Source: https://context7.com/yangzongzhuan/ruoyi-vue/llms.txt Creates a new user, allowing assignment of roles and posts. Passwords are automatically encrypted using BCrypt before storage. ```bash curl -X POST "http://localhost:8080/system/user" \ -H "Authorization: Bearer eyJhbGciOiJIUzUxMiJ9..." \ -H "Content-Type: application/json" \ -d '{ "deptId": 103, "userName": "zhangsan", "nickName": "张三", "password": "123456", "phonenumber": "13800138000", "email": "zhangsan@example.com", "sex": "0", "status": "0", "postIds": [1], "roleIds": [2] }' ``` -------------------------------- ### File Download (Bash) Source: https://context7.com/yangzongzhuan/ruoyi-vue/llms.txt Enables downloading files from the server. Supports specifying the filename and whether to delete the file after download. Requires an Authorization header. ```bash # 文件下载 curl -X GET "http://localhost:8080/common/download?fileName=document_20240115.pdf&delete=false" \ -H "Authorization: Bearer eyJhbGciOiJIUzUxMiJ9..." \ -o downloaded_file.pdf # 资源文件下载 curl -X GET "http://localhost:8080/common/download/resource?resource=/profile/upload/2024/01/15/document.pdf" \ -H "Authorization: Bearer eyJhbGciOiJIUzUxMiJ9..." \ -o downloaded_file.pdf ``` -------------------------------- ### Application Configuration (YAML) Source: https://context7.com/yangzongzhuan/ruoyi-vue/llms.txt Shows core configuration settings for the RuoYi application, including project name, version, file paths, and server/Redis/token settings. ```yaml # application.yml 核心配置 ruoyi: name: RuoYi version: 3.9.1 profile: D:/ruoyi/uploadPath # 文件存储路径 captchaType: math # 验证码类型:math/char server: port: 8080 servlet: context-path: / spring: redis: host: localhost port: 6379 database: 0 token: header: Authorization # Token 请求头 secret: abcdefghijklmnopqrstuvwxyz # JWT 密钥 expireTime: 30 # Token 有效期(分钟) ``` -------------------------------- ### Add Role (Bash) Source: https://context7.com/yangzongzhuan/ruoyi-vue/llms.txt Creates a new role with specified name, permissions, and status. Allows assignment of menu permissions. Requires an authentication token. ```bash # 新增角色 curl -X POST "http://localhost:8080/system/role" \ -H "Authorization: Bearer eyJhbGciOiJIUzUxMiJ9..." \ -H "Content-Type: application/json" \ -d '{ "roleName": "测试角色", "roleKey": "test", "roleSort": 3, "status": "0", "menuIds": [1, 100, 101, 102, 103], "remark": "测试角色描述" }' # 响应示例 { "code": 200, "msg": "操作成功" } ``` -------------------------------- ### Add Department (Bash) Source: https://context7.com/yangzongzhuan/ruoyi-vue/llms.txt Creates a new department, allowing specification of parent department, leader, and other details. Requires an authentication token. ```bash # 新增部门 curl -X POST "http://localhost:8080/system/dept" \ -H "Authorization: Bearer eyJhbGciOiJIUzUxMiJ9..." \ -H "Content-Type: application/json" \ -d '{ "parentId": 100, "deptName": "研发部", "orderNum": 1, "leader": "张三", "phone": "13800138000", "email": "dev@example.com", "status": "0" }' # 响应示例 { "code": 200, "msg": "操作成功" } ``` -------------------------------- ### Multiple File Upload (Bash) Source: https://context7.com/yangzongzhuan/ruoyi-vue/llms.txt Allows for the batch upload of multiple files. Requires an Authorization header and a multipart/form-data request with multiple 'files' fields. ```bash # 多文件上传 curl -X POST "http://localhost:8080/common/uploads" \ -H "Authorization: Bearer eyJhbGciOiJIUzUxMiJ9..." \ -F "files=@/path/to/file1.pdf" \ -F "files=@/path/to/file2.pdf" # 响应示例 { "code": 200, "msg": "操作成功", "urls": "http://localhost:8080/profile/upload/file1.pdf,http://localhost:8080/profile/upload/file2.pdf", "fileNames": "/profile/upload/file1.pdf,/profile/upload/file2.pdf" } ``` -------------------------------- ### User Login (Bash) Source: https://context7.com/yangzongzhuan/ruoyi-vue/llms.txt Authenticates a user with username, password, and CAPTCHA code. Returns a JWT Token upon successful authentication. The token is used for subsequent API requests and has a configurable default expiration time. ```bash curl -X POST "http://localhost:8080/login" \ -H "Content-Type: application/json" \ -d '{ "username": "admin", "password": "admin123", "code": "8", "uuid": "5f8b3a2c1d4e6f7g8h9i0j1k" }' ``` -------------------------------- ### Parameter Configuration API Source: https://context7.com/yangzongzhuan/ruoyi-vue/llms.txt APIs for managing system parameters, including retrieving values by key and refreshing the cache. ```APIDOC ## GET /system/config/configKey/{configKey} ### Description Retrieves the system configuration parameter value based on the provided parameter key. ### Method GET ### Endpoint /system/config/configKey/{configKey} ### Parameters #### Path Parameters - **configKey** (string) - Required - The key of the configuration parameter to retrieve. ### Response #### Success Response (200) - **code** (integer) - Status code, 200 for success. - **msg** (string) - Response message, "操作成功" for success. - **data** (string) - The value of the configuration parameter. #### Response Example ```json { "code": 200, "msg": "操作成功", "data": "true" } ``` ``` ```APIDOC ## DELETE /system/config/refreshCache ### Description Clears and reloads the system parameter configuration cache. ### Method DELETE ### Endpoint /system/config/refreshCache ### Response #### Success Response (200) - **code** (integer) - Status code, 200 for success. - **msg** (string) - Response message, "操作成功" for success. #### Response Example ```json { "code": 200, "msg": "操作成功" } ``` ``` -------------------------------- ### File Upload and Download API Source: https://context7.com/yangzongzhuan/ruoyi-vue/llms.txt APIs for handling file uploads (single and multiple) and file downloads. ```APIDOC ## POST /common/upload ### Description Provides a general file upload interface that supports various file types. ### Method POST ### Endpoint /common/upload ### Parameters #### Request Body - **file** (file) - Required - The file to upload. ### Request Example ```bash curl -X POST "http://localhost:8080/common/upload" \ -H "Authorization: Bearer eyJhbGciOiJIUzUxMiJ9..." \ -F "file=@/path/to/document.pdf" ``` ### Response #### Success Response (200) - **code** (integer) - Status code, 200 for success. - **msg** (string) - Response message, "操作成功" for success. - **url** (string) - The URL of the uploaded file. - **fileName** (string) - The server path of the uploaded file. - **newFileName** (string) - The new name of the uploaded file. - **originalFilename** (string) - The original name of the uploaded file. #### Response Example ```json { "code": 200, "msg": "操作成功", "url": "http://localhost:8080/profile/upload/2024/01/15/document_20240115.pdf", "fileName": "/profile/upload/2024/01/15/document_20240115.pdf", "newFileName": "document_20240115.pdf", "originalFilename": "document.pdf" } ``` ``` ```APIDOC ## POST /common/uploads ### Description Allows for the batch upload of multiple files. ### Method POST ### Endpoint /common/uploads ### Parameters #### Request Body - **files** (file) - Required - The files to upload (can be multiple). ### Request Example ```bash curl -X POST "http://localhost:8080/common/uploads" \ -H "Authorization: Bearer eyJhbGciOiJIUzUxMiJ9..." \ -F "files=@/path/to/file1.pdf" \ -F "files=@/path/to/file2.pdf" ``` ### Response #### Success Response (200) - **code** (integer) - Status code, 200 for success. - **msg** (string) - Response message, "操作成功" for success. - **urls** (string) - Comma-separated URLs of the uploaded files. - **fileNames** (string) - Comma-separated server paths of the uploaded files. #### Response Example ```json { "code": 200, "msg": "操作成功", "urls": "http://localhost:8080/profile/upload/file1.pdf,http://localhost:8080/profile/upload/file2.pdf", "fileNames": "/profile/upload/file1.pdf,/profile/upload/file2.pdf" } ``` ``` ```APIDOC ## GET /common/download ### Description Downloads a file from the server. ### Method GET ### Endpoint /common/download ### Parameters #### Query Parameters - **fileName** (string) - Required - The name of the file to download. - **delete** (boolean) - Optional - Whether to delete the file after download (defaults to false). ### Request Example ```bash curl -X GET "http://localhost:8080/common/download?fileName=document_20240115.pdf&delete=false" \ -H "Authorization: Bearer eyJhbGciOiJIUzUxMiJ9..." \ -o downloaded_file.pdf ``` ## GET /common/download/resource ### Description Downloads a resource file from the server. ### Method GET ### Endpoint /common/download/resource ### Parameters #### Query Parameters - **resource** (string) - Required - The path to the resource file to download. ### Request Example ```bash curl -X GET "http://localhost:8080/common/download/resource?resource=/profile/upload/2024/01/15/document.pdf" \ -H "Authorization: Bearer eyJhbGciOiJIUzUxMiJ9..." \ -o downloaded_file.pdf ``` ``` -------------------------------- ### Menu Management API Source: https://context7.com/yangzongzhuan/ruoyi-vue/llms.txt APIs for managing system menus, including listing, creating, and retrieving menu trees for roles. ```APIDOC ## GET /system/menu/list ### Description Retrieves a list of system menus, returning a complete menu tree including directories, menus, and buttons. ### Method GET ### Endpoint /system/menu/list ### Response #### Success Response (200) - **code** (integer) - The status code of the operation. - **msg** (string) - A message indicating the result of the operation. - **data** (array) - An array of menu objects representing the menu tree. - **menuId** (integer) - The ID of the menu. - **menuName** (string) - The name of the menu. - **parentId** (integer) - The ID of the parent menu. - **orderNum** (integer) - The order number of the menu. - **path** (string) - The route path for the menu. - **component** (string) - The component path for the menu. - **menuType** (string) - The type of menu ('M' for directory, 'C' for menu, 'F' for button). - **visible** (string) - Visibility status ('0' visible, '1' hidden). - **status** (string) - Status of the menu ('0' normal, '1' disabled). - **perms** (string) - Permissions string associated with the menu. - **icon** (string) - The icon class for the menu. #### Response Example ```json { "code": 200, "msg": "操作成功", "data": [ { "menuId": 1, "menuName": "系统管理", "parentId": 0, "orderNum": 1, "path": "system", "component": null, "menuType": "M", "visible": "0", "status": "0", "perms": "", "icon": "system" } ] } ``` ## POST /system/menu ### Description Creates a new menu item. Supports three types: directory (M), menu (C), and button (F). ### Method POST ### Endpoint /system/menu ### Parameters #### Request Body - **parentId** (integer) - Optional - The ID of the parent menu. - **menuType** (string) - Required - The type of menu ('M' for directory, 'C' for menu, 'F' for button). - **menuName** (string) - Required - The name of the menu. - **orderNum** (integer) - Optional - The order number for the menu. - **path** (string) - Optional - The route path for the menu. - **component** (string) - Optional - The component path for the menu. - **perms** (string) - Optional - The permissions string for the menu. - **icon** (string) - Optional - The icon class for the menu. - **visible** (string) - Optional - Visibility status ('0' visible, '1' hidden). - **status** (string) - Optional - Status of the menu ('0' normal, '1' disabled). ### Request Example ```json { "parentId": 1, "menuType": "C", "menuName": "测试菜单", "orderNum": 10, "path": "test", "component": "system/test/index", "perms": "system:test:list", "icon": "edit", "visible": "0", "status": "0" } ``` ### Response #### Success Response (200) - **code** (integer) - The status code of the operation. - **msg** (string) - A message indicating the result of the operation. #### Response Example ```json { "code": 200, "msg": "操作成功" } ``` ## GET /system/menu/roleMenuTreeselect/{roleId} ### Description Retrieves the menu tree for a specific role, showing already assigned menus for role authorization. ### Method GET ### Endpoint /system/menu/roleMenuTreeselect/{roleId} ### Parameters #### Path Parameters - **roleId** (integer) - Required - The ID of the role. ### Response #### Success Response (200) - **code** (integer) - The status code of the operation. - **msg** (string) - A message indicating the result of the operation. - **checkedKeys** (array) - An array of IDs for the menus already assigned to the role. - **menus** (array) - An array of menu objects representing the menu tree. - **id** (integer) - The ID of the menu. - **label** (string) - The name of the menu. - **children** (array) - An array of child menus. #### Response Example ```json { "code": 200, "msg": "操作成功", "checkedKeys": [1, 100, 101, 102], "menus": [ { "id": 1, "label": "系统管理", "children": [ { "id": 100, "label": "用户管理" }, { "id": 101, "label": "角色管理" } ] } ] } ``` ``` -------------------------------- ### Refresh Parameter Cache (Bash) Source: https://context7.com/yangzongzhuan/ruoyi-vue/llms.txt Clears and reloads the system parameter configuration cache. Requires an Authorization header. ```bash # 刷新参数缓存 curl -X DELETE "http://localhost:8080/system/config/refreshCache" \ -H "Authorization: Bearer eyJhbGciOiJIUzUxMiJ9..." # 响应示例 { "code": 200, "msg": "操作成功" } ``` -------------------------------- ### Single File Upload (Bash) Source: https://context7.com/yangzongzhuan/ruoyi-vue/llms.txt A general-purpose file upload endpoint that supports various file types. Requires an Authorization header and a multipart/form-data request with the file. ```bash # 单文件上传 curl -X POST "http://localhost:8080/common/upload" \ -H "Authorization: Bearer eyJhbGciOiJIUzUxMiJ9..." \ -F "file=@/path/to/document.pdf" # 响应示例 { "code": 200, "msg": "操作成功", "url": "http://localhost:8080/profile/upload/2024/01/15/document_20240115.pdf", "fileName": "/profile/upload/2024/01/15/document_20240115.pdf", "newFileName": "document_20240115.pdf", "originalFilename": "document.pdf" } ``` -------------------------------- ### Authentication and Authorization APIs Source: https://context7.com/yangzongzhuan/ruoyi-vue/llms.txt APIs related to user authentication, including obtaining verification codes, user login, and retrieving user information. ```APIDOC ## GET /captchaImage ### Description Obtains a graphical verification code, returning a Base64 encoded image and its corresponding UUID for login validation. Supports mathematical and character-based verification codes, switchable via configuration. ### Method GET ### Endpoint /captchaImage ### Parameters #### Query Parameters None #### Request Body None ### Request Example ```bash curl -X GET "http://localhost:8080/captchaImage" ``` ### Response #### Success Response (200) - **code** (integer) - Response status code. - **msg** (string) - Response message. - **captchaEnabled** (boolean) - Indicates if captcha is enabled. - **uuid** (string) - Unique identifier for the captcha. - **img** (string) - Base64 encoded captcha image. #### Response Example ```json { "code": 200, "msg": "操作成功", "captchaEnabled": true, "uuid": "5f8b3a2c1d4e6f7g8h9i0j1k", "img": "/9j/4AAQSkZJRgABAgAAAQABAAD/2wBDAAgGBgcGBQgHBwcJCQ..." } ``` ``` ```APIDOC ## POST /login ### Description Authenticates a user with username, password, and verification code, returning a JWT Token upon successful validation. The token is used for subsequent API authentication and has a default validity period of 30 minutes. ### Method POST ### Endpoint /login ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **username** (string) - Required - The user's username. - **password** (string) - Required - The user's password. - **code** (string) - Required - The verification code entered by the user. - **uuid** (string) - Required - The UUID of the verification code obtained from `/captchaImage`. ### Request Example ```json { "username": "admin", "password": "admin123", "code": "8", "uuid": "5f8b3a2c1d4e6f7g8h9i0j1k" } ``` ### Response #### Success Response (200) - **code** (integer) - Response status code. - **msg** (string) - Response message. - **token** (string) - JWT Token for authentication. #### Response Example ```json { "code": 200, "msg": "操作成功", "token": "eyJhbGciOiJIUzUxMiJ9.eyJsb2dpbl91c2VyX2tleSI6IjEyMzQ1Njc4OTAifQ..." } ``` ``` ```APIDOC ## GET /getInfo ### Description Retrieves detailed information about the currently logged-in user, including their basic profile, roles, and permissions. Requires a valid JWT Token in the `Authorization` header. ### Method GET ### Endpoint /getInfo ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```bash curl -X GET "http://localhost:8080/getInfo" \ -H "Authorization: Bearer eyJhbGciOiJIUzUxMiJ9..." ``` ### Response #### Success Response (200) - **code** (integer) - Response status code. - **msg** (string) - Response message. - **user** (object) - User profile details. - **userId** (integer) - User ID. - **userName** (string) - Username. - **nickName** (string) - User's nickname. - **email** (string) - User's email. - **phonenumber** (string) - User's phone number. - **deptId** (integer) - Department ID. - **status** (string) - User status ('0' for normal, '1' for disabled). - **roles** (array) - Array of roles assigned to the user. - **permissions** (array) - Array of permissions granted to the user. - **isDefaultModifyPwd** (boolean) - Indicates if the user is using the default password. - **isPasswordExpired** (boolean) - Indicates if the user's password has expired. #### Response Example ```json { "code": 200, "msg": "操作成功", "user": { "userId": 1, "userName": "admin", "nickName": "管理员", "email": "admin@ruoyi.vip", "phonenumber": "15888888888", "deptId": 103, "status": "0" }, "roles": ["admin"], "permissions": ["*:*:*"], "isDefaultModifyPwd": false, "isPasswordExpired": false } ``` ``` ```APIDOC ## GET /getRouters ### Description Retrieves the frontend routing menu for the current user, dynamically generated based on their roles. The frontend uses this data to render the sidebar navigation. ### Method GET ### Endpoint /getRouters ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```bash curl -X GET "http://localhost:8080/getRouters" \ -H "Authorization: Bearer eyJhbGciOiJIUzUxMiJ9..." ``` ### Response #### Success Response (200) - **code** (integer) - Response status code. - **msg** (string) - Response message. - **data** (array) - Array of route objects representing the menu structure. - **name** (string) - Route name. - **path** (string) - Route path. - **hidden** (boolean) - Whether the route is hidden. - **component** (string) - The component to render for this route. - **meta** (object) - Metadata for the route. - **title** (string) - Title displayed in the navigation. - **icon** (string) - Icon for the navigation item. - **children** (array) - Nested routes. #### Response Example ```json { "code": 200, "msg": "操作成功", "data": [ { "name": "System", "path": "/system", "hidden": false, "component": "Layout", "meta": { "title": "系统管理", "icon": "system" }, "children": [ { "name": "User", "path": "user", "component": "system/user/index", "meta": { "title": "用户管理", "icon": "user" } } ] } ] } ``` ``` ```APIDOC ## POST /register ### Description Allows new users to register an account. This feature is only available if the system's registration is enabled (configured via `sys.account.registerUser` setting). ### Method POST ### Endpoint /register ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **username** (string) - Required - The desired username for the new account. - **password** (string) - Required - The password for the new account. - **code** (string) - Required - The verification code. - **uuid** (string) - Required - The UUID of the verification code. ### Request Example ```json { "username": "testuser", "password": "Test@123456", "code": "5", "uuid": "abc123def456" } ``` ### Response #### Success Response (200) - **code** (integer) - Response status code. - **msg** (string) - Response message. #### Response Example ```json { "code": 200, "msg": "操作成功" } ``` ``` -------------------------------- ### User Management APIs Source: https://context7.com/yangzongzhuan/ruoyi-vue/llms.txt APIs for managing users, including listing, creating, updating, deleting, and resetting passwords. ```APIDOC ## GET /system/user/list ### Description Paged query for the user list, supporting filtering by username, phone number, status, and department. Requires the `system:user:list` permission. ### Method GET ### Endpoint /system/user/list ### Parameters #### Path Parameters None #### Query Parameters - **pageNum** (integer) - Optional - The current page number. - **pageSize** (integer) - Optional - The number of items per page. - **userName** (string) - Optional - Filter by username. - **phonenumber** (string) - Optional - Filter by phone number. - **status** (string) - Optional - Filter by user status ('0' for normal, '1' for disabled). - **deptId** (integer) - Optional - Filter by department ID. #### Request Body None ### Request Example ```bash curl -X GET "http://localhost:8080/system/user/list?pageNum=1&pageSize=10&userName=admin" \ -H "Authorization: Bearer eyJhbGciOiJIUzUxMiJ9..." ``` ### Response #### Success Response (200) - **code** (integer) - Response status code. - **msg** (string) - Response message. - **total** (integer) - Total number of users matching the query. - **rows** (array) - Array of user objects. - **userId** (integer) - User ID. - **deptId** (integer) - Department ID. - **userName** (string) - Username. - **nickName** (string) - User's nickname. - **email** (string) - User's email. - **phonenumber** (string) - User's phone number. - **status** (string) - User status ('0' for normal, '1' for disabled). - **createTime** (string) - Timestamp of user creation. #### Response Example ```json { "code": 200, "msg": "查询成功", "total": 2, "rows": [ { "userId": 1, "deptId": 103, "userName": "admin", "nickName": "管理员", "email": "admin@ruoyi.vip", "phonenumber": "15888888888", "status": "0", "createTime": "2024-01-01 00:00:00" } ] } ``` ``` ```APIDOC ## POST /system/user ### Description Creates a new user. Allows assigning roles and posts. Passwords are automatically BCrypt encrypted before storage. ### Method POST ### Endpoint /system/user ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **deptId** (integer) - Required - The department ID for the user. - **userName** (string) - Required - The username for the new user. - **nickName** (string) - Required - The nickname for the new user. - **password** (string) - Required - The password for the new user. - **phonenumber** (string) - Optional - The phone number of the user. - **email** (string) - Optional - The email address of the user. - **sex** (string) - Optional - The sex of the user ('0' for male, '1' for female, '2' for unknown). - **status** (string) - Optional - The status of the user ('0' for normal, '1' for disabled). - **postIds** (array of integers) - Optional - Array of post IDs assigned to the user. - **roleIds** (array of integers) - Optional - Array of role IDs assigned to the user. ### Request Example ```json { "deptId": 103, "userName": "zhangsan", "nickName": "张三", "password": "123456", "phonenumber": "13800138000", "email": "zhangsan@example.com", "sex": "0", "status": "0", "postIds": [1], "roleIds": [2] } ``` ### Response #### Success Response (200) - **code** (integer) - Response status code. - **msg** (string) - Response message. #### Response Example ```json { "code": 200, "msg": "操作成功" } ``` ``` ```APIDOC ## PUT /system/user ### Description Updates existing user information, including basic details, role assignments, and post assignments. ### Method PUT ### Endpoint /system/user ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **userId** (integer) - Required - The ID of the user to update. - **deptId** (integer) - Required - The department ID for the user. - **userName** (string) - Required - The username. - **nickName** (string) - Required - The nickname. - **phonenumber** (string) - Optional - The phone number of the user. - **email** (string) - Optional - The email address of the user. - **sex** (string) - Optional - The sex of the user ('0' for male, '1' for female, '2' for unknown). - **status** (string) - Optional - The status of the user ('0' for normal, '1' for disabled). - **postIds** (array of integers) - Optional - Array of post IDs assigned to the user. - **roleIds** (array of integers) - Optional - Array of role IDs assigned to the user. ### Request Example ```json { "userId": 2, "deptId": 103, "userName": "zhangsan", "nickName": "张三更新", "phonenumber": "13800138001", "email": "zhangsan_new@example.com", "sex": "0", "status": "0", "postIds": [1, 2], "roleIds": [2, 3] } ``` ### Response #### Success Response (200) - **code** (integer) - Response status code. - **msg** (string) - Response message. #### Response Example ```json { "code": 200, "msg": "操作成功" } ``` ``` ```APIDOC ## DELETE /system/user/{userIds} ### Description Deletes users in batch. Deleting the currently logged-in user is not permitted. ### Method DELETE ### Endpoint /system/user/{userIds} ### Parameters #### Path Parameters - **userIds** (string) - Required - A comma-separated string of user IDs to delete. #### Query Parameters None #### Request Body None ### Request Example ```bash curl -X DELETE "http://localhost:8080/system/user/2,3,4" \ -H "Authorization: Bearer eyJhbGciOiJIUzUxMiJ9..." ``` ### Response #### Success Response (200) - **code** (integer) - Response status code. - **msg** (string) - Response message. #### Response Example ```json { "code": 200, "msg": "操作成功" } ``` ``` ```APIDOC ## PUT /system/user/resetPwd ### Description Resets the password for a specified user by an administrator. ### Method PUT ### Endpoint /system/user/resetPwd ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **userId** (integer) - Required - The ID of the user whose password needs to be reset. - **password** (string) - Required - The new password for the user. ### Request Example ```json { "userId": 2, "password": "NewPassword123" } ``` ### Response #### Success Response (200) - **code** (integer) - Response status code. - **msg** (string) - Response message. #### Response Example ```json { "code": 200, "msg": "操作成功" } ``` ```