Maintainers
Pricing
Enterprise
More
More
Documentation
Try Live
Rankings
Install
Blog
Docs7
Ask
New
Add Docs
Ygcode Test
https://github.com/xwh1238070/ygcode-test
Admin
This is a test project with no specific content provided for analysis.
Tokens:
5,158
Snippets:
16
Trust Score:
3.1
Update:
10 months ago
Context
Chat
Benchmark
Latest
Show doc for...
Code
Info
Show Results
Tokens:
Raw
Copy
Link
Tokens:
Raw
Copy
Link
### JavaScript Mock Data Configuration: User Management API Source: https://context7.com/xwh1238070/ygcode-test/llms.txt Provides mock data configurations for user management API endpoints using JavaScript. This allows frontend developers to work with API simulations before the backend is fully implemented. It supports GET and POST requests for listing, adding, deleting, and resetting passwords for users, including basic filtering and pagination for the user list. Dependencies include standard JavaScript features. ```javascript // mock.js - User management mock configuration export default { doGet: { '/api/user/list': (params) => { const mockUsers = [ { userId: 'U001', username: 'admin', realName: '张三', department: '技术部' }, { userId: 'U002', username: 'lisi', realName: '李四', department: '市场部' } ]; // Apply filters let filtered = mockUsers; if (params.username) { filtered = filtered.filter(u => u.username.includes(params.username)); } if (params.department) { filtered = filtered.filter(u => u.department === params.department); } // Apply pagination const start = (params.pageIndex - 1) * params.pageSize; const end = start + params.pageSize; return { code: 0, data: filtered.slice(start, end), total: filtered.length }; } }, doPost: { '/api/user/add': (data) => { console.log('Mock: Adding user', data); return { code: 0, message: '新增成功', data: 'U' + Date.now() }; }, '/api/user/delete': (data) => { console.log('Mock: Deleting users', data.userIds); return { code: 0, message: '删除成功', data: data.userIds.length }; }, '/api/user/resetPassword': (data) => { return { code: 0, message: '密码已重置为123456' }; } } }; ``` -------------------------------- ### User Management Frontend API Source: https://context7.com/xwh1238070/ygcode-test/llms.txt Provides endpoints for querying and managing user accounts. Supports search, pagination, and batch operations. ```APIDOC ## GET /api/users ### Description Queries a list of users with support for filtering by various criteria and pagination. ### Method GET ### Endpoint /api/users ### Parameters #### Query Parameters - **username** (string) - Optional - Filter by username. - **realName** (string) - Optional - Filter by real name. - **department** (string) - Optional - Filter by department. - **role** (string) - Optional - Filter by role. - **status** (string) - Optional - Filter by user status (e.g., '1' for enabled). - **createTime** (array) - Optional - Filter by creation date range (e.g., ['YYYY-MM-DD', 'YYYY-MM-DD']). - **pageSize** (integer) - Optional - Number of records per page (default: 20). - **pageIndex** (integer) - Optional - Current page index (default: 1). ### Response #### Success Response (200) - **users** (array) - A list of user objects. - **userId** (string) - Unique identifier for the user. - **username** (string) - The user's login name. - **realName** (string) - The user's real name. - **department** (string) - The department the user belongs to. - **role** (string) - The user's role. - **phone** (string) - The user's phone number. - **email** (string) - The user's email address. - **status** (string) - The user's current status (e.g., '启用', '禁用'). - **createTime** (string) - The timestamp when the user was created. - **lastLoginTime** (string) - The timestamp of the user's last login. - **total** (integer) - The total number of records matching the query. #### Response Example ```json { "users": [ { "userId": "U001", "username": "admin", "realName": "张三", "department": "技术部", "role": "系统管理员", "phone": "13800138001", "email": "zhangsan@example.com", "status": "启用", "createTime": "2024-01-15 10:30:00", "lastLoginTime": "2024-12-15 09:15:00" } ], "total": 1 } ``` ``` -------------------------------- ### User Management Frontend API: Query and Manage Users Source: https://context7.com/xwh1238070/ygcode-test/llms.txt Provides functionality to query and manage user accounts. Supports filtering by username, real name, department, role, status, and creation time. Includes pagination and retrieval of total records. Uses the `UserManagementBusiness` class. ```typescript import UserManagementBusiness from './user-management/Business'; // Initialize business logic const business = new UserManagementBusiness(); // Query users with filters and pagination const queryParams = { username: 'admin', realName: '张三', department: '技术部', role: '系统管理员', status: '1', createTime: ['2024-01-01', '2024-12-31'] }; business.dataModel.query = queryParams; const users = await business.getGridData(20, 1); // pageSize=20, pageIndex=1 const total = await business.getTotalRecord(); // Expected response format // users = [ // { // userId: 'U001', // username: 'admin', // realName: '张三', // department: '技术部', // role: '系统管理员', // phone: '13800138001', // email: 'zhangsan@example.com', // status: '启用', // createTime: '2024-01-15 10:30:00', // lastLoginTime: '2024-12-15 09:15:00' // } // ] ``` -------------------------------- ### Task Management API: Query and Manage Tasks Source: https://context7.com/xwh1238070/ygcode-test/llms.txt Facilitates task management with filtering by name, status, priority, assignee, and date range. Supports creating, updating, and deleting tasks, as well as batch completion and data export. Uses the `TaskManagementBusiness` class. ```typescript import TaskManagementBusiness from './task-management/Business'; const taskBusiness = new TaskManagementBusiness(); // Query tasks with filters taskBusiness.dataModel.query = { taskName: '项目', status: 'pending', // pending|in_progress|completed|cancelled priority: 'high', // high|medium|low assignee: '张三', dateRange: ['2024-01-01', '2024-12-31'] }; const tasks = await taskBusiness.getGridData(20, 1); const totalTasks = await taskBusiness.getTotalRecord(); // Create new task const newTask = { taskName: '新任务', description: '任务描述', priority: 'high', assignee: '张三', dueDate: '2024-12-31' }; await taskBusiness.addTask(newTask); // Update task await taskBusiness.updateTask({ id: 1, taskName: '更新的任务', status: 'in_progress', priority: 'medium' }); // Batch operations const taskIds = [1, 2, 3]; await taskBusiness.deleteTask(taskIds); await taskBusiness.completeTask(taskIds); await taskBusiness.exportTasks(); ``` -------------------------------- ### Java Backend Service Layer: User Management Operations Source: https://context7.com/xwh1238070/ygcode-test/llms.txt Implements the service layer for user management operations in a Java Spring Boot application. It handles user creation, deletion, and password reset, utilizing Data Transfer Objects (DTOs), Business Objects (BOs), and Data Access Objects (DAOs). Transaction management and custom exceptions are employed for robust data handling. Dependencies include Spring Framework, domain models, and utility classes. ```java package com.ygsoft.user.management.service.application; import com.ygsoft.user.management.domain.bo.UserBO; import com.ygsoft.user.management.domain.vo.UserVO; import com.ygsoft.user.management.domain.vo.UserBatchVO; import com.ygsoft.user.management.domain.transfer.UserTransfer; import com.ygsoft.user.management.dao.UserDao; import com.ygsoft.user.management.infrastructure.util.PasswordUtil; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @Service public class UserServiceImpl implements UserService { @Autowired private UserDao userDao; @Transactional @Override public String createUser(UserVO userVO) { // Validate username uniqueness if (userDao.existsByUsername(userVO.getUsername())) { throw new BusinessException(ErrorCode.USERNAME_EXISTS); } // Convert VO to BO UserBO userBO = UserTransfer.voToBO(userVO); userBO.setPassword(PasswordUtil.encrypt(UserConstant.DEFAULT_PASSWORD)); userBO.setStatus(UserConstant.STATUS_ENABLED); userBO.setCreateTime(new Date()); // Save to database UserPO savedUser = userDao.save(UserTransfer.boToPO(userBO)); return savedUser.getUserId(); } @Transactional @Override public int deleteUsers(UserBatchVO batchVO) { List<String> userIds = batchVO.getUserIds(); if (userIds == null || userIds.isEmpty()) { throw new BusinessException(ErrorCode.PARAM_EMPTY); } if (userIds.size() > UserConstant.MAX_BATCH_SIZE) { throw new BusinessException(ErrorCode.BATCH_SIZE_EXCEED); } return userDao.deleteByUserIdIn(userIds); } @Transactional @Override public int resetPassword(UserBatchVO batchVO) { String encryptedPassword = PasswordUtil.encrypt(UserConstant.DEFAULT_PASSWORD); return userDao.updatePasswordByUserIdIn( batchVO.getUserIds(), encryptedPassword ); } } ``` -------------------------------- ### User Management Frontend API: CRUD Operations Source: https://context7.com/xwh1238070/ygcode-test/llms.txt Enables creation, updating, and deletion of user accounts, along with batch operations for status management and data export/import. Utilizes the `UserManagementBusiness` class for all operations. ```typescript // Add new user const newUser = { username: 'newuser', realName: '新用户', department: '技术部', role: '普通用户', phone: '13800138888', email: 'newuser@example.com' }; const result = await business.addUser(newUser); // Edit existing user await business.editUser('U001', { realName: '张三', department: '技术部', phone: '13800138001', email: 'zhangsan@example.com' }); // Batch operations const userIds = ['U001', 'U002', 'U003']; await business.deleteUser(userIds); await business.resetPassword(userIds); await business.enableUser(userIds); await business.disableUser(userIds); // Export/Import await business.exportData(); await business.importData(fileObject); ``` -------------------------------- ### Task Management API Source: https://context7.com/xwh1238070/ygcode-test/llms.txt Manages tasks, including status tracking, priority settings, and filtering capabilities. ```APIDOC ## GET /api/tasks ### Description Retrieves a list of tasks with filtering options based on name, status, priority, assignee, and date range. ### Method GET ### Endpoint /api/tasks ### Parameters #### Query Parameters - **taskName** (string) - Optional - Filter tasks by name. - **status** (string) - Optional - Filter tasks by status (e.g., 'pending', 'in_progress', 'completed', 'cancelled'). - **priority** (string) - Optional - Filter tasks by priority (e.g., 'high', 'medium', 'low'). - **assignee** (string) - Optional - Filter tasks by the assigned user's name. - **dateRange** (array) - Optional - Filter tasks within a date range (e.g., ['YYYY-MM-DD', 'YYYY-MM-DD']). - **pageSize** (integer) - Optional - Number of records per page (default: 20). - **pageIndex** (integer) - Optional - Current page index (default: 1). ### Response #### Success Response (200) - **tasks** (array) - A list of task objects. - **id** (integer) - Unique identifier for the task. - **taskName** (string) - The name of the task. - **description** (string) - A detailed description of the task. - **status** (string) - The current status of the task. - **priority** (string) - The priority level of the task. - **assignee** (string) - The name of the user assigned to the task. - **dueDate** (string) - The due date for the task. - **totalTasks** (integer) - The total number of tasks matching the query. #### Response Example ```json { "tasks": [ { "id": 1, "taskName": "项目启动", "description": "完成项目启动会议", "status": "pending", "priority": "high", "assignee": "张三", "dueDate": "2024-12-31" } ], "totalTasks": 1 } ``` ## POST /api/tasks/add ### Description Creates a new task in the system. ### Method POST ### Endpoint /api/tasks/add ### Parameters #### Request Body - **taskName** (string) - Required - The name of the task. - **description** (string) - Optional - A description of the task. - **priority** (string) - Optional - The priority level (e.g., 'high', 'medium', 'low'). - **assignee** (string) - Optional - The user assigned to the task. - **dueDate** (string) - Optional - The due date for the task (YYYY-MM-DD). ### Request Example ```json { "taskName": "新任务", "description": "任务描述", "priority": "high", "assignee": "张三", "dueDate": "2024-12-31" } ``` ## PUT /api/tasks/update ### Description Updates an existing task with new details. ### Method PUT ### Endpoint /api/tasks/update ### Parameters #### Request Body - **id** (integer) - Required - The unique identifier of the task to update. - **taskName** (string) - Optional - The updated task name. - **status** (string) - Optional - The updated task status. - **priority** (string) - Optional - The updated task priority. ### Request Example ```json { "id": 1, "taskName": "更新的任务", "status": "in_progress", "priority": "medium" } ``` ## DELETE /api/tasks/batch/delete ### Description Deletes multiple tasks by their IDs. ### Method DELETE ### Endpoint /api/tasks/batch/delete ### Parameters #### Request Body - **taskIds** (array) - Required - A list of task IDs to delete. - **id** (integer) - The ID of the task. ### Request Example ```json { "taskIds": [1, 2, 3] } ``` ## POST /api/tasks/batch/complete ### Description Marks multiple tasks as completed. ### Method POST ### Endpoint /api/tasks/batch/complete ### Parameters #### Request Body - **taskIds** (array) - Required - A list of task IDs to mark as complete. - **id** (integer) - The ID of the task. ### Request Example ```json { "taskIds": [1, 2, 3] } ``` ## POST /api/tasks/export ### Description Exports task data. ### Method POST ### Endpoint /api/tasks/export ### Parameters No parameters required. ``` -------------------------------- ### User CRUD Operations API Source: https://context7.com/xwh1238070/ygcode-test/llms.txt Handles the creation, updating, deletion, and status management of user accounts, including batch operations. ```APIDOC ## POST /api/users/add ### Description Adds a new user to the system. ### Method POST ### Endpoint /api/users/add ### Parameters #### Request Body - **username** (string) - Required - The desired username for the new user. - **realName** (string) - Required - The real name of the user. - **department** (string) - Required - The department the user belongs to. - **role** (string) - Required - The role assigned to the user. - **phone** (string) - Optional - The user's phone number. - **email** (string) - Optional - The user's email address. ### Request Example ```json { "username": "newuser", "realName": "新用户", "department": "技术部", "role": "普通用户", "phone": "13800138888", "email": "newuser@example.com" } ``` ## PUT /api/users/edit/{userId} ### Description Updates an existing user's information. ### Method PUT ### Endpoint /api/users/edit/{userId} ### Parameters #### Path Parameters - **userId** (string) - Required - The unique identifier of the user to update. #### Request Body - **realName** (string) - Optional - The updated real name of the user. - **department** (string) - Optional - The updated department. - **phone** (string) - Optional - The updated phone number. - **email** (string) - Optional - The updated email address. ### Request Example ```json { "realName": "张三", "department": "技术部", "phone": "13800138001", "email": "zhangsan@example.com" } ``` ## DELETE /api/users/batch/delete ### Description Deletes one or more users from the system in a batch operation. ### Method DELETE ### Endpoint /api/users/batch/delete ### Parameters #### Request Body - **userIds** (array) - Required - A list of user IDs to delete. - **userId** (string) - The ID of the user to delete. ### Request Example ```json { "userIds": ["U001", "U002", "U003"] } ``` ## POST /api/users/batch/reset-password ### Description Resets the passwords for one or more specified users. ### Method POST ### Endpoint /api/users/batch/reset-password ### Parameters #### Request Body - **userIds** (array) - Required - A list of user IDs for whom to reset passwords. - **userId** (string) - The ID of the user. ### Request Example ```json { "userIds": ["U001", "U002", "U003"] } ``` ## POST /api/users/batch/enable ### Description Enables one or more specified users. ### Method POST ### Endpoint /api/users/batch/enable ### Parameters #### Request Body - **userIds** (array) - Required - A list of user IDs to enable. - **userId** (string) - The ID of the user. ### Request Example ```json { "userIds": ["U001", "U002", "U003"] } ``` ## POST /api/users/batch/disable ### Description Disables one or more specified users. ### Method POST ### Endpoint /api/users/batch/disable ### Parameters #### Request Body - **userIds** (array) - Required - A list of user IDs to disable. - **userId** (string) - The ID of the user. ### Request Example ```json { "userIds": ["U001", "U002", "U003"] } ``` ## POST /api/users/export ### Description Exports user data. ### Method POST ### Endpoint /api/users/export ### Parameters No parameters required. ## POST /api/users/import ### Description Imports user data from a file. ### Method POST ### Endpoint /api/users/import ### Parameters #### Request Body - **fileObject** (object) - Required - The file object containing user data for import. ### Request Example ```json { "fileObject": "<file_content_or_reference>" } ``` ```