# TomAgent **Repository Path**: miacandyfang/tom-agent ## Basic Information - **Project Name**: TomAgent - **Description**: Tom哥打造的智能体 - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2026-01-05 - **Last Updated**: 2026-02-14 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # Tom Agent Project Documentation Tom Agent is a backend service application built on Spring Boot, designed to provide user management functionalities including user login, registration, information updates, password changes, and user deletion, with an integrated global exception handling mechanism. ## Project Features - Rapid backend service setup using Spring Boot. - Integrated MyBatis Plus to simplify database operations. - Provides unified RESTful API interfaces. - Modularized exception handling via `GlobalExceptionHandler` for centralized management of various exceptions. - Supports CRUD operations on user information with security controls. - Modular design with clear structure for easy maintenance and extension. ## Module Overview - `TomAgentApplication`: Application entry point. - `SysUserController`: RESTful API endpoints for user-related operations. - `SysUserService`: Interface for user business logic. - `SysUserServiceImpl`: Implementation of user business logic. - `SysUserMapper`: Interface for database operations on users. - `SysUser`: User entity class, mapping to the `sys_user` database table. - `MyMetaObjectHandler`: Automatically fills creation and update timestamps. - `MybatisPlusConfig`: Configuration for MyBatis Plus plugins. - `GlobalExceptionHandler`: Global exception handler that catches and processes runtime exceptions. - `BusinessException`: Custom business exception class. ## Quick Start ### Prerequisites - JDK 1.8 or higher - Maven 3.5 or higher - MySQL 5.7 or higher - Git ### Build and Run 1. **Clone the Project** ```bash git clone https://gitee.com/miacandyfang/tom-agent.git cd tom-agent ``` 2. **Configure the Database** Update the database connection settings in `src/main/resources/application.yml`: ```yaml spring: datasource: url: jdbc:mysql://localhost:3306/tom_agent?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai username: root password: root driver-class-name: com.mysql.cj.jdbc.Driver ``` 3. **Build the Project** ```bash mvn clean install ``` 4. **Run the Project** ```bash mvn spring-boot:run ``` 5. **Access APIs** After successful startup, test the APIs at `http://localhost:8080/api/user`. ## API Documentation - **User Login**: `POST /api/user/login` - **User Registration**: `POST /api/user/register` - **Get User Information**: `GET /api/user/info/{id}` - **Update User Information**: `PUT /api/user/update` - **Change Password**: `POST /api/user/change-password` - **Delete User**: `DELETE /api/user/delete/{id}` ## Exception Handling The system includes a global exception handler that manages the following exception types: - `BusinessException`: Business logic exceptions - `NullPointerException`: Null pointer exceptions - `IllegalArgumentException`: Invalid parameter exceptions - `RuntimeException`: Runtime exceptions - `Exception`: General exception catch-all ## Logging The system uses `logback` as the logging framework. Configuration is located at `src/main/resources/logback-spring.xml`. ## Testing The project includes a unit test class `TomAgentApplicationTests`. Run tests using: ```bash mvn test ``` ## Contributions Issues and pull requests are welcome to help improve this project. ## License This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.