### Frontend Application Startup (Bash) Source: https://github.com/marsfactory/mars-admin/blob/master/README.md Commands to install dependencies and start the frontend development server. This uses npm for package management and running the development script. ```bash cd mars-ui npm install npm run dev ``` -------------------------------- ### Project Setup and Initialization (Bash) Source: https://github.com/marsfactory/mars-admin/blob/master/README.md Instructions for cloning the project repository and initializing the database. This involves using Git to clone the project and SQL commands to set up the database schema. ```bash git clone https://gitee.com/Marsfactory/mars-admin.git cd mars-admin ``` ```sql -- 创建数据库 CREATE DATABASE mars-system DEFAULT CHARACTER SET utf8mb4; -- 导入 SQL mysql -u root -p mars-system < sql/mars-system.sql ``` -------------------------------- ### GET /api/sys/notice/page Source: https://context7.com/marsfactory/mars-admin/llms.txt Admin endpoint to paginate and query system notifications. ```APIDOC ## GET /api/sys/notice/page ### Description Admin endpoint to paginate and query system notifications. ### Method GET ### Endpoint /api/sys/notice/page ### Query Parameters - **page** (integer) - Required - The page number for pagination. - **pageSize** (integer) - Required - The number of items per page. - **title** (string) - Optional - Filter by notification title. - **noticeType** (integer) - Optional - Filter by notification type (1 for notice, 2 for announcement). - **status** (integer) - Optional - Filter by notification status (e.g., 1 for active). ### Request Example ```bash curl -X GET 'http://localhost:8080/api/sys/notice/page?page=1&pageSize=10&title=系统¬iceType=1&status=1' \ -H 'Authorization: Bearer {token}' ``` ### Response #### Success Response (200) - **code** (integer) - The status code of the operation. - **message** (string) - A message indicating the result of the operation. - **data** (object) - The paginated list of notifications. - **records** (array) - An array of notification objects. - **total** (integer) - The total number of notifications. - **current** (integer) - The current page number. - **size** (integer) - The number of items per page. #### Response Example (Response structure for this endpoint is not provided in the input text.) ``` -------------------------------- ### Backend Application Startup (Bash) Source: https://github.com/marsfactory/mars-admin/blob/master/README.md Commands to build and run the backend Spring Boot application. It involves Maven commands for cleaning, installing, and running the application. ```bash mvn clean install cd mars-starter mvn spring-boot:run ``` -------------------------------- ### GET /api/sys/menu/tree Source: https://context7.com/marsfactory/mars-admin/llms.txt Retrieves the system menu structure as a tree. ```APIDOC ## GET /api/sys/menu/tree ### Description Fetches the menu tree structure, supporting filtering by name and status. ### Method GET ### Endpoint /api/sys/menu/tree ### Parameters #### Query Parameters - **name** (string) - Optional - Filter by menu name - **status** (integer) - Optional - Filter by status ### Response #### Success Response (200) - **data** (array) - Tree structure of menus #### Response Example { "code": 200, "message": "操作成功", "data": [ { "id": 1, "name": "系统管理", "children": [] } ] } ``` -------------------------------- ### Get System Monitoring Info Source: https://context7.com/marsfactory/mars-admin/llms.txt Retrieves comprehensive system metrics including CPU, memory, JVM, and disk usage statistics. ```bash curl -X GET 'http://localhost:8080/api/monitor/server' -H 'Authorization: Bearer {token}' ``` -------------------------------- ### Get Public System Configuration Source: https://context7.com/marsfactory/mars-admin/llms.txt Retrieves public-facing system settings such as site information, login policies, and storage constraints without requiring authentication. ```bash curl -X GET 'http://localhost:8080/api/sys/config-group/public' ``` -------------------------------- ### Custom Login Strategy Implementation (Java) Source: https://github.com/marsfactory/mars-admin/blob/master/README.md Example of creating a custom login strategy by implementing the LoginStrategy interface in Java. This allows for custom authentication logic within the system. ```java @Component public class CustomLoginStrategy implements LoginStrategy { @Override public LoginResult login(LoginRequest request) { // 自定义登录逻辑 } } ``` -------------------------------- ### Get Role Details API (Bash) Source: https://context7.com/marsfactory/mars-admin/llms.txt Fetches detailed information for a specific role, including assigned menus and data scope permissions. Requires authentication token. ```bash curl -X GET 'http://localhost:8080/api/sys/role/1' \ -H 'Authorization: Bearer {token}' ``` -------------------------------- ### Get Server Metrics Source: https://context7.com/marsfactory/mars-admin/llms.txt Retrieves comprehensive server health metrics including CPU, memory, JVM status, and disk usage. ```bash curl -X GET 'http://localhost:8080/api/monitor/server/info' -H 'Authorization: Bearer {token}' ``` -------------------------------- ### Get Online Users Source: https://context7.com/marsfactory/mars-admin/llms.txt Lists all currently authenticated users, including session details and login metadata. ```bash curl -X GET 'http://localhost:8080/api/monitor/online/list' -H 'Authorization: Bearer {token}' ``` -------------------------------- ### GET /api/sys/config-group/{groupCode} Source: https://context7.com/marsfactory/mars-admin/llms.txt Retrieves the detailed configuration for a specific configuration group. ```APIDOC ## GET /api/sys/config-group/{groupCode} ### Description Retrieves the detailed configuration for a specific configuration group. ### Method GET ### Endpoint /api/sys/config-group/{groupCode} ### Parameters #### Path Parameters - **groupCode** (string) - Required - The unique code of the configuration group (e.g., 'security') ### Response #### Success Response (200) - **code** (integer) - Status code - **message** (string) - Operation status message - **data** (object) - Configuration details object #### Response Example { "code": 200, "message": "操作成功", "data": { "id": 1, "groupCode": "security", "groupName": "安全配置", "configValue": "{\"tokenTimeout\":86400,\"tokenActiveTimeout\":3600}" } } ``` -------------------------------- ### Get Task Execution Logs Source: https://context7.com/marsfactory/mars-admin/llms.txt Retrieves paginated logs for scheduled task executions. ```bash curl -X GET 'http://localhost:8080/api/monitor/job/log/page?page=1&pageSize=10&jobName=清理&status=1' -H 'Authorization: Bearer {token}' ``` -------------------------------- ### Get Menu Tree API (Bash) Source: https://context7.com/marsfactory/mars-admin/llms.txt Retrieves the menu structure in a tree format, with options to filter by name and status. Requires authentication token. ```bash curl -X GET 'http://localhost:8080/api/sys/menu/tree?name=用户&status=1' \ -H 'Authorization: Bearer {token}' ``` -------------------------------- ### GET /api/sys/notice/my Source: https://context7.com/marsfactory/mars-admin/llms.txt Retrieves the current user's notification list with optional filtering by read status. ```APIDOC ## GET /api/sys/notice/my ### Description Retrieves the current user's notification list, supporting pagination and read status filtering. ### Method GET ### Endpoint /api/sys/notice/my ### Parameters #### Query Parameters - **page** (integer) - Required - Page number - **pageSize** (integer) - Required - Number of records per page - **isRead** (integer) - Optional - Filter by read status (0: unread, 1: read) ### Response #### Success Response (200) - **code** (integer) - Status code - **message** (string) - Success message - **data** (object) - Notification data records #### Response Example { "code": 200, "message": "操作成功", "data": { "records": [ { "id": 1, "title": "系统更新通知", "content": "系统将于今晚22:00进行维护升级", "noticeType": 1, "isRead": 0, "createTime": "2024-01-01 10:00:00" } ], "total": 1, "current": 1, "size": 10 } } ``` -------------------------------- ### Get User Group List Source: https://context7.com/marsfactory/mars-admin/llms.txt Retrieves all group chats that the current user has joined. ```bash curl -X GET 'http://localhost:8080/api/chat/group/list' \ -H 'Authorization: Bearer {token}' ``` -------------------------------- ### Get Chat User List Source: https://context7.com/marsfactory/mars-admin/llms.txt Retrieves a list of users available for chat, including the last message and blacklist status. ```bash curl -X GET 'http://localhost:8080/api/sys/chat/users' \ -H 'Authorization: Bearer {token}' ``` -------------------------------- ### GET /api/sys/config-group/public Source: https://context7.com/marsfactory/mars-admin/llms.txt Retrieves public system configurations such as site information, login settings, and password policies without requiring authentication. ```APIDOC ## GET /api/sys/config-group/public ### Description Retrieves public system configurations such as site information, login settings, and password policies without requiring authentication. ### Method GET ### Endpoint /api/sys/config-group/public ### Parameters #### Query Parameters - None ### Request Example curl -X GET 'http://localhost:8080/api/sys/config-group/public' ### Response #### Success Response (200) - **data** (object) - Configuration groups including system, login, register, password, and storage settings #### Response Example { "code": 200, "message": "操作成功", "data": { "system": { "siteName": "Mars Admin" }, "login": { "captchaEnabled": true } } } ``` -------------------------------- ### Adding Operation Logs (Java) Source: https://github.com/marsfactory/mars-admin/blob/master/README.md Example of how to automatically log user operations using the @Log annotation in a Java Spring Boot controller. It specifies the log title and business type. ```java @Log(title = "用户管理", businessType = BusinessType.INSERT) @PostMapping public Result add(@RequestBody SysUser user) { // ... } ``` -------------------------------- ### GET /api/monitor/online/list Source: https://context7.com/marsfactory/mars-admin/llms.txt Retrieves a list of currently logged-in users. ```APIDOC ## GET /api/monitor/online/list ### Description Fetches the list of all currently active users in the system. ### Method GET ### Endpoint /api/monitor/online/list ### Response #### Success Response (200) - **data** (array) - List of online user objects #### Response Example { "code": 200, "message": "操作成功", "data": [ { "tokenId": "satoken:session:1", "loginName": "admin", "ipaddr": "192.168.1.100", "status": 1 } ] } ``` -------------------------------- ### GET /api/sys/role/page Source: https://context7.com/marsfactory/mars-admin/llms.txt Paginated retrieval of roles with filtering capabilities. ```APIDOC ## GET /api/sys/role/page ### Description Retrieves a paginated list of roles, supporting filtering by name and status. ### Method GET ### Endpoint /api/sys/role/page ### Parameters #### Query Parameters - **page** (integer) - Required - Current page number - **pageSize** (integer) - Required - Number of records per page - **name** (string) - Optional - Filter by role name - **status** (integer) - Optional - Filter by status ### Response #### Success Response (200) - **records** (array) - List of role objects - **total** (integer) - Total record count #### Response Example { "code": 200, "message": "操作成功", "data": { "records": [ { "id": 1, "name": "超级管理员", "code": "admin", "status": 1 } ], "total": 1 } } ``` -------------------------------- ### Create User API (Bash) Source: https://context7.com/marsfactory/mars-admin/llms.txt Creates a new user with specified roles and posts. Requires authentication token and JSON payload with user details, role IDs, and post IDs. ```bash curl -X POST 'http://localhost:8080/api/sys/user' \ -H 'Authorization: Bearer {token}' \ -H 'Content-Type: application/json' \ -d '{ "user": { "username": "zhangsan", "nickname": "张三", "password": "123456", "email": "zhangsan@example.com", "phone": "13800138001", "gender": 1, "status": 1, "deptId": 100 }, "roleIds": [2], "postIds": [1] }' ``` -------------------------------- ### Import Users API (Bash) Source: https://context7.com/marsfactory/mars-admin/llms.txt Imports user data in bulk from an Excel file. Requires authentication token and the Excel file uploaded as 'file'. ```bash curl -X POST 'http://localhost:8080/api/sys/user/import' \ -H 'Authorization: Bearer {token}' \ -F 'file=@users.xlsx' ``` -------------------------------- ### GET /api/dashboard/stats Source: https://context7.com/marsfactory/mars-admin/llms.txt Retrieves statistical data for the system dashboard. ```APIDOC ## GET /api/dashboard/stats ### Description Retrieves system dashboard statistics including user, role, and permission counts. ### Method GET ### Endpoint /api/dashboard/stats ### Response #### Success Response (200) - **data** (object) - Contains userCount, roleCount, menuCount, permissionCount #### Response Example { "code": 200, "message": "操作成功", "data": { "userCount": 100, "roleCount": 10, "menuCount": 50, "permissionCount": 120 } } ``` -------------------------------- ### Create Role API (Bash) Source: https://context7.com/marsfactory/mars-admin/llms.txt Creates a new role with associated menu and data scope permissions. Requires authentication token and a JSON payload. ```bash curl -X POST 'http://localhost:8080/api/sys/role' \ -H 'Authorization: Bearer {token}' \ -H 'Content-Type: application/json' \ -d '{ "role": { "name": "普通用户", "code": "user", "sort": 2, "status": 1, "dataScope": 2 }, "menuIds": [1, 2, 3], "deptIds": [100] }' ``` -------------------------------- ### Get Chat History Source: https://context7.com/marsfactory/mars-admin/llms.txt Retrieves the chat history with a specific user, supporting pagination. ```bash curl -X GET 'http://localhost:8080/api/sys/chat/history/2?page=1&pageSize=20' \ -H 'Authorization: Bearer {token}' ``` -------------------------------- ### Manage Code Generation Source: https://context7.com/marsfactory/mars-admin/llms.txt Handles database table discovery, importing structures, previewing generated code, syncing changes, and downloading or generating project files. ```bash curl -X GET 'http://localhost:8080/api/tool/gen/db/list?page=1&pageSize=10&tableName=sys' -H 'Authorization: Bearer {token}' curl -X POST 'http://localhost:8080/api/tool/gen/import' -H 'Authorization: Bearer {token}' -H 'Content-Type: application/json' -d '["sys_config", "sys_log"]' curl -X GET 'http://localhost:8080/api/tool/gen/preview/1' -H 'Authorization: Bearer {token}' curl -X POST 'http://localhost:8080/api/tool/gen/generate/1' -H 'Authorization: Bearer {token}' curl -X GET 'http://localhost:8080/api/tool/gen/download?ids=1,2' -H 'Authorization: Bearer {token}' -o code.zip curl -X POST 'http://localhost:8080/api/tool/gen/sync/1' -H 'Authorization: Bearer {token}' ``` -------------------------------- ### Get Group Message History Source: https://context7.com/marsfactory/mars-admin/llms.txt Retrieves paginated message history for a specific group. ```bash curl -X GET 'http://localhost:8080/api/chat/group/1/messages?page=1&pageSize=50' \ -H 'Authorization: Bearer {token}' ``` -------------------------------- ### Create System Notification Source: https://context7.com/marsfactory/mars-admin/llms.txt Creates a new system notification with a title, content, and type. ```bash curl -X POST 'http://localhost:8080/api/sys/notice' -H 'Authorization: Bearer {token}' -H 'Content-Type: application/json' -d '{"title": "新功能上线通知", "content": "我们上线了全新的即时通讯功能,欢迎体验!", "noticeType": 1, "status": 0}' ``` -------------------------------- ### GET /api/monitor/cache/stats Source: https://context7.com/marsfactory/mars-admin/llms.txt Retrieves Redis cache statistics including memory usage, operations, and connected clients. ```APIDOC ## GET /api/monitor/cache/stats ### Description Retrieves Redis cache statistics including memory usage, operations, and connected clients. ### Method GET ### Endpoint /api/monitor/cache/stats ### Parameters #### Query Parameters - None ### Request Example curl -X GET 'http://localhost:8080/api/monitor/cache/stats' -H 'Authorization: Bearer {token}' ### Response #### Success Response (200) - **data** (object) - Cache statistics object #### Response Example { "code": 200, "message": "操作成功", "data": { "usedMemory": 52428800, "maxMemory": 104857600, "ops": 150, "hitRate": 0.95, "connectedClients": 10 } } ``` -------------------------------- ### Manage Departments Source: https://context7.com/marsfactory/mars-admin/llms.txt Endpoints for retrieving department trees, creating new departments, and moving departments within the hierarchy. ```bash curl -X GET 'http://localhost:8080/api/sys/dept/tree?deptName=技术&status=1' -H 'Authorization: Bearer {token}' curl -X POST 'http://localhost:8080/api/sys/dept' -H 'Authorization: Bearer {token}' -H 'Content-Type: application/json' -d '{"parentId": 100, "deptName": "产品部", "leader": "王经理", "phone": "13800138002", "email": "product@example.com", "sort": 2, "status": 1}' curl -X PUT 'http://localhost:8080/api/sys/dept/move?id=102&parentId=101&sort=1' -H 'Authorization: Bearer {token}' ``` -------------------------------- ### POST /api/sys/user Source: https://context7.com/marsfactory/mars-admin/llms.txt Creates a new user and assigns roles and posts. ```APIDOC ## POST /api/sys/user ### Description Creates a new user, simultaneously assigning roles and posts. ### Method POST ### Endpoint /api/sys/user ### Request Body - **user** (object) - Required - User details (username, nickname, password, email, phone, gender, status, deptId) - **roleIds** (array) - Required - List of role IDs - **postIds** (array) - Required - List of post IDs ### Request Example { "user": { "username": "zhangsan", "nickname": "张三", "password": "123456", "email": "zhangsan@example.com", "phone": "13800138001", "gender": 1, "status": 1, "deptId": 100 }, "roleIds": [2], "postIds": [1] } ### Response #### Success Response (200) - **code** (integer) - Status code - **message** (string) - Operation status message #### Response Example { "code": 200, "message": "操作成功", "data": null } ``` -------------------------------- ### Get My Notifications Source: https://context7.com/marsfactory/mars-admin/llms.txt Retrieves the current user's notification list. Supports pagination and filtering by read status. ```bash curl -X GET 'http://localhost:8080/api/sys/notice/my?page=1&pageSize=10&isRead=0' -H 'Authorization: Bearer {token}' ``` -------------------------------- ### Implement WebSocket Real-time Communication Source: https://context7.com/marsfactory/mars-admin/llms.txt Establishes a WebSocket connection for real-time message handling, including chat, system notifications, and heartbeat management. ```javascript const token = 'your_token_here'; const ws = new WebSocket(`ws://localhost:8080/ws/message?token=${token}`); ws.onmessage = (event) => { const data = JSON.parse(event.data); // Handle message types: connected, chat, groupChat, notice, unread, pong }; setInterval(() => { if (ws.readyState === WebSocket.OPEN) ws.send(JSON.stringify({ type: 'ping' })); }, 30000); function sendChatMessage(receiverId, content) { ws.send(JSON.stringify({ type: 'chat', receiverId, content })); } ``` -------------------------------- ### Manage System Configuration via REST API Source: https://context7.com/marsfactory/mars-admin/llms.txt Endpoints for retrieving and updating system configuration groups, including security settings and service testing for email and SMS. ```bash curl -X GET 'http://localhost:8080/api/sys/config-group/security' -H 'Authorization: Bearer {token}' curl -X POST 'http://localhost:8080/api/sys/config-group/security' -H 'Authorization: Bearer {token}' -H 'Content-Type: application/json' -d '{"tokenTimeout": 86400, "tokenActiveTimeout": 3600, "maxLoginCount": 5, "lockDuration": 1800}' curl -X POST 'http://localhost:8080/api/sys/config-group/test-email' -H 'Authorization: Bearer {token}' -H 'Content-Type: application/json' -d '{"to": "test@example.com"}' curl -X POST 'http://localhost:8080/api/sys/config-group/test-sms' -H 'Authorization: Bearer {token}' -H 'Content-Type: application/json' -d '{"phone": "13800138000"}' ``` -------------------------------- ### Authentication API Endpoints (Bash) Source: https://context7.com/marsfactory/mars-admin/llms.txt Provides bash commands for interacting with the authentication API. Includes endpoints for fetching CAPTCHAs, sending SMS verification codes, user login (password, SMS, mini-program), logout, retrieving user info, user registration, and password modification. Each endpoint shows the request method, URL, headers, and sample JSON payload/response. ```bash curl -X GET 'http://localhost:8080/api/auth/captcha' # 响应示例 { "code": 200, "message": "操作成功", "data": { "uuid": "abc123def456", "img": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIIAAAAwCAIAAABpB..." } } ``` ```bash curl -X POST 'http://localhost:8080/api/auth/sms-code' \ -H 'Content-Type: application/json' \ -d '{"phone": "13800138000"}' # 响应示例 { "code": 200, "message": "操作成功", "data": null } ``` ```bash # 密码登录 curl -X POST 'http://localhost:8080/api/auth/login' \ -H 'Content-Type: application/json' \ -d '{ \ "loginType": "PASSWORD", \ "username": "admin", \ "password": "123456", \ "uuid": "abc123def456", \ "code": "1234", \ "rememberMe": true \ }' # 短信验证码登录 curl -X POST 'http://localhost:8080/api/auth/login' \ -H 'Content-Type: application/json' \ -d '{ \ "loginType": "SMS_CODE", \ "phone": "13800138000", \ "smsCode": "123456" \ }' # 小程序登录 curl -X POST 'http://localhost:8080/api/auth/login' \ -H 'Content-Type: application/json' \ -d '{ \ "loginType": "MINI_PROGRAM", \ "wxCode": "wx_login_code", \ "phoneCode": "wx_phone_code" \ }' # 响应示例 { "code": 200, "message": "操作成功", "data": { "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...", "userId": 1, "username": "admin", "nickname": "管理员", "avatar": "/uploads/avatar.png" } } ``` ```bash curl -X POST 'http://localhost:8080/api/auth/logout' \ -H 'Authorization: Bearer {token}' # 响应示例 { "code": 200, "message": "操作成功", "data": null } ``` ```bash curl -X GET 'http://localhost:8080/api/auth/info' \ -H 'Authorization: Bearer {token}' # 响应示例 { "code": 200, "message": "操作成功", "data": { "user": { "id": 1, "username": "admin", "nickname": "管理员", "email": "admin@example.com", "phone": "13800138000", "avatar": "/uploads/avatar.png", "gender": 1, "status": 1 }, "roles": ["admin", "user"], "permissions": ["sys:user:list", "sys:user:add", "sys:user:edit"], "menus": [ { "id": 1, "name": "系统管理", "path": "/system", "component": "Layout", "children": [] } ] } } ``` ```bash curl -X POST 'http://localhost:8080/api/auth/register' \ -H 'Content-Type: application/json' \ -d '{ \ "username": "newuser", \ "password": "Password123!", \ "nickname": "新用户", \ "email": "newuser@example.com", \ "phone": "13900139000", \ "uuid": "abc123def456", \ "code": "1234" \ }' # 响应示例 { "code": 200, "message": "操作成功", "data": null } ``` ```bash curl -X POST 'http://localhost:8080/api/auth/password' \ -H 'Authorization: Bearer {token}' \ -H 'Content-Type: application/json' \ -d '{ \ "oldPassword": "123456", \ "newPassword": "NewPassword123!" \ }' # 响应示例 { "code": 200, "message": "操作成功", "data": null } ``` -------------------------------- ### Create Group Chat Source: https://context7.com/marsfactory/mars-admin/llms.txt Creates a new group chat and adds an initial list of members. ```bash curl -X POST 'http://localhost:8080/api/chat/group/create' \ -H 'Authorization: Bearer {token}' \ -H 'Content-Type: application/json' \ -d '{ "name": "项目讨论组", "memberIds": [2, 3, 4] }' ``` -------------------------------- ### Manage System Menus Source: https://context7.com/marsfactory/mars-admin/llms.txt Operations to create, update, and delete system menus or button permissions. These endpoints require a valid Bearer token for authorization. ```bash curl -X POST 'http://localhost:8080/api/sys/menu' -H 'Authorization: Bearer {token}' -H 'Content-Type: application/json' -d '{"parentId": 2, "name": "添加用户", "menuType": 2, "permission": "sys:user:add", "sort": 1, "status": 1}' curl -X PUT 'http://localhost:8080/api/sys/menu' -H 'Authorization: Bearer {token}' -H 'Content-Type: application/json' -d '{"id": 3, "parentId": 2, "name": "新增用户", "menuType": 2, "permission": "sys:user:add", "sort": 1, "status": 1}' curl -X DELETE 'http://localhost:8080/api/sys/menu/3' -H 'Authorization: Bearer {token}' ``` -------------------------------- ### User Management API Endpoints (Bash) Source: https://context7.com/marsfactory/mars-admin/llms.txt Provides bash commands for interacting with the user management API. Includes endpoints for paginating user lists with various filter options and retrieving detailed information for a specific user. Each endpoint shows the request method, URL, headers, and sample JSON payload/response. ```bash curl -X GET 'http://localhost:8080/api/sys/user/page?page=1&pageSize=10&username=admin&status=1&deptId=100' \ -H 'Authorization: Bearer {token}' # 响应示例 { "code": 200, "message": "操作成功", "data": { "records": [ { "id": 1, "username": "admin", "nickname": "管理员", "email": "admin@example.com", "phone": "13800138000", "status": 1, "deptId": 100, "createTime": "2024-01-01 00:00:00" } ], "total": 1, "current": 1, "size": 10 } } ``` ```bash curl -X GET 'http://localhost:8080/api/sys/user/1' \ -H 'Authorization: Bearer {token}' # 响应示例 { "code": 200, "message": "操作成功", "data": { "user": { "id": 1, "username": "admin", "nickname": "管理员", "email": "admin@example.com", "phone": "13800138000", "gender": 1, "status": 1, "deptId": 100 }, "roleIds": [1, 2], "postIds": [1] } } ``` -------------------------------- ### Manage Files Source: https://context7.com/marsfactory/mars-admin/llms.txt Comprehensive file management including uploading files/images, paginated retrieval, downloading, and batch deletion. ```bash curl -X POST 'http://localhost:8080/api/sys/file/upload' -H 'Authorization: Bearer {token}' -F 'file=@document.pdf' -F 'path=/documents' -F 'groupId=1' curl -X POST 'http://localhost:8080/api/sys/file/upload/image' -H 'Authorization: Bearer {token}' -F 'file=@photo.jpg' curl -X GET 'http://localhost:8080/api/sys/file/page-by-group?page=1&pageSize=20&groupId=1&fileCategory=image' -H 'Authorization: Bearer {token}' curl -X GET 'http://localhost:8080/api/sys/file/download/1' -H 'Authorization: Bearer {token}' -o downloaded_file.pdf curl -X DELETE 'http://localhost:8080/api/sys/file/batch' -H 'Authorization: Bearer {token}' -H 'Content-Type: application/json' -d '[1, 2, 3]' ``` -------------------------------- ### Paginate Roles API (Bash) Source: https://context7.com/marsfactory/mars-admin/llms.txt Retrieves a paginated list of roles, with options to filter by name and status. Requires authentication token. ```bash curl -X GET 'http://localhost:8080/api/sys/role/page?page=1&pageSize=10&name=管理员&status=1' \ -H 'Authorization: Bearer {token}' ``` -------------------------------- ### Backend Application Configuration (YAML) Source: https://github.com/marsfactory/mars-admin/blob/master/README.md Configuration settings for the backend application, specifically for development environment. This includes database connection details and Redis configuration. ```yaml spring: datasource: url: jdbc:mysql://localhost:3306/mars-system username: root password: your_password data: redis: host: localhost port: 6379 password: database: 10 ``` -------------------------------- ### POST /api/monitor/job Source: https://context7.com/marsfactory/mars-admin/llms.txt Creates a new scheduled task in the system. ```APIDOC ## POST /api/monitor/job ### Description Creates a new scheduled task with specific cron expression and execution details. ### Method POST ### Endpoint /api/monitor/job ### Parameters #### Request Body - **jobName** (string) - Required - Name of the task - **jobGroup** (string) - Required - Group name - **invokeTarget** (string) - Required - Method to invoke - **cronExpression** (string) - Required - Cron schedule - **status** (integer) - Required - 0 for pause, 1 for normal ### Response #### Success Response (200) - **code** (integer) - Status code - **message** (string) - Success message #### Response Example { "code": 200, "message": "操作成功", "data": null } ``` -------------------------------- ### Export Users API (Bash) Source: https://context7.com/marsfactory/mars-admin/llms.txt Exports user data to an Excel file. Supports filtering by username and status. Requires authentication token. ```bash curl -X GET 'http://localhost:8080/api/sys/user/export?username=admin&status=1' \ -H 'Authorization: Bearer {token}' \ -o users.xlsx ``` -------------------------------- ### Manage Dictionaries Source: https://context7.com/marsfactory/mars-admin/llms.txt Operations for querying dictionary types via pagination and creating new dictionary definitions. ```bash curl -X GET 'http://localhost:8080/api/sys/dict/type/page?page=1&pageSize=10&dictName=状态&dictType=sys_status' -H 'Authorization: Bearer {token}' curl -X POST 'http://localhost:8080/api/sys/dict/type' -H 'Authorization: Bearer {token}' -H 'Content-Type: application/json' -d '{"dictName": "用户性别", "dictType": "sys_gender", "status": 1, "remark": "用户性别字典"}' ``` -------------------------------- ### POST /api/sys/config-group/{groupCode} Source: https://context7.com/marsfactory/mars-admin/llms.txt Saves the configuration settings for a specific configuration group. ```APIDOC ## POST /api/sys/config-group/{groupCode} ### Description Saves the configuration settings for a specific configuration group. ### Method POST ### Endpoint /api/sys/config-group/{groupCode} ### Parameters #### Path Parameters - **groupCode** (string) - Required - The unique code of the configuration group #### Request Body - **tokenTimeout** (integer) - Optional - Token expiration time - **tokenActiveTimeout** (integer) - Optional - Token active timeout - **maxLoginCount** (integer) - Optional - Maximum login attempts - **lockDuration** (integer) - Optional - Account lock duration ### Response #### Success Response (200) - **code** (integer) - Status code - **message** (string) - Operation status message #### Response Example { "code": 200, "message": "操作成功", "data": null } ``` -------------------------------- ### Menu Management API Source: https://context7.com/marsfactory/mars-admin/llms.txt APIs for creating, updating, and deleting menu items and button permissions. ```APIDOC ## POST /api/sys/menu ### Description Creates a new menu or button permission. ### Method POST ### Endpoint /api/sys/menu ### Parameters #### Request Body - **parentId** (integer) - Required - The ID of the parent menu. - **name** (string) - Required - The name of the menu. - **menuType** (integer) - Required - The type of the menu (e.g., 2 for button). - **permission** (string) - Required - The permission string. - **sort** (integer) - Optional - The sort order of the menu. - **status** (integer) - Optional - The status of the menu (e.g., 1 for enabled). ### Request Example ```json { "parentId": 2, "name": "添加用户", "menuType": 2, "permission": "sys:user:add", "sort": 1, "status": 1 } ``` ### Response #### Success Response (200) - **code** (integer) - Operation status code. - **message** (string) - Operation result message. - **data** (null) - Response data, null for this operation. #### Response Example ```json { "code": 200, "message": "操作成功", "data": null } ``` ## PUT /api/sys/menu ### Description Updates an existing menu item. ### Method PUT ### Endpoint /api/sys/menu ### Parameters #### Request Body - **id** (integer) - Required - The ID of the menu to update. - **parentId** (integer) - Optional - The ID of the parent menu. - **name** (string) - Optional - The name of the menu. - **menuType** (integer) - Optional - The type of the menu. - **permission** (string) - Optional - The permission string. - **sort** (integer) - Optional - The sort order of the menu. - **status** (integer) - Optional - The status of the menu. ### Request Example ```json { "id": 3, "parentId": 2, "name": "新增用户", "menuType": 2, "permission": "sys:user:add", "sort": 1, "status": 1 } ``` ### Response #### Success Response (200) - **code** (integer) - Operation status code. - **message** (string) - Operation result message. - **data** (null) - Response data, null for this operation. #### Response Example ```json { "code": 200, "message": "操作成功", "data": null } ``` ## DELETE /api/sys/menu/{id} ### Description Deletes a specified menu item. ### Method DELETE ### Endpoint /api/sys/menu/{id} ### Parameters #### Path Parameters - **id** (integer) - Required - The ID of the menu to delete. ### Response #### Success Response (200) - **code** (integer) - Operation status code. - **message** (string) - Operation result message. - **data** (null) - Response data, null for this operation. #### Response Example ```json { "code": 200, "message": "操作成功", "data": null } ``` ``` -------------------------------- ### Set Group Admin Source: https://context7.com/marsfactory/mars-admin/llms.txt Promotes or demotes a user to/from group administrator status. ```bash curl -X POST 'http://localhost:8080/api/chat/group/1/admin/2?isAdmin=true' \ -H 'Authorization: Bearer {token}' ``` -------------------------------- ### POST /api/tool/gen/import Source: https://context7.com/marsfactory/mars-admin/llms.txt Imports database table structures into the system for code generation purposes. ```APIDOC ## POST /api/tool/gen/import ### Description Imports database table structures into the system for code generation purposes. ### Method POST ### Endpoint /api/tool/gen/import ### Parameters #### Request Body - **tables** (array) - Required - List of table names to import ### Request Example { "tables": ["sys_config", "sys_log"] } ### Response #### Success Response (200) - **code** (integer) - Status code #### Response Example { "code": 200, "message": "操作成功", "data": null } ``` -------------------------------- ### WebSocket /ws/message Source: https://context7.com/marsfactory/mars-admin/llms.txt Establishes a WebSocket connection for real-time message delivery. ```APIDOC ## WebSocket /ws/message ### Description Establishes a persistent connection for real-time notifications, chat, and system updates. ### Endpoint ws://localhost:8080/ws/message?token={token} ### Message Types - **connected**: Connection confirmation - **chat**: Private message - **groupChat**: Group message - **notice**: System notification - **unread**: Unread message count update - **pong**: Heartbeat response ``` -------------------------------- ### Retrieve Dashboard Statistics Source: https://context7.com/marsfactory/mars-admin/llms.txt Fetches system-wide summary statistics including user, role, menu, and permission counts. ```bash curl -X GET 'http://localhost:8080/api/dashboard/stats' -H 'Authorization: Bearer {token}' ```