# aiex-framework **Repository Path**: Loudxx/aiex-framework ## Basic Information - **Project Name**: aiex-framework - **Description**: aiex后台管理平台框架相关 - **Primary Language**: Java - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2024-04-29 - **Last Updated**: 2025-11-26 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # aiex-framework ## 介绍 aiex-freamework是aiex后台管理系统的核心框架 ## 工程结构 - **aiex-boot**:Spring Boot相关配置和启动类。 - **aiex-cloud**:Spring Cloud相关实现和配置。 - **aiex-modules**:包含多个功能模块。 - **aiex-core**:核心功能模块,包括基础类、异常处理、工具类等。 - **aiex-db**:数据库相关配置和持久层实现。 - **aiex-security**:安全模块,集成Spring Security和JWT。 - **aiex-web**:Web模块,包含控制器、异常处理、Redis配置等。 ## 主要功能 - **分页支持**:提供通用的分页类`Page`和`PageDTO`,简化分页查询的实现。 - **基础类**:提供基础的控制器、领域模型、数据传输对象(DTO)和业务对象(BO)。 - **异常处理**:统一的异常处理机制,支持自定义错误码和异常信息。 - **安全模块**:集成Spring Security,支持JWT认证和授权。 - **Web工具类**:提供IP地址解析、JSON处理、HTTP请求处理等实用工具。 - **Redis缓存**:提供基于Redis的缓存服务,支持多种数据结构的操作。 ## 快速开始 ### 环境要求 - Java 17+ - Maven 3.8+ - Spring Boot 2.7+ - Spring Cloud 2021+ ### 启动项目 1. **启动Spring Boot应用**: ```java @AixBootApplication public class AixBootApplication { public static void main(String[] args) { AixApplication.run(AixStartApplication.class, args); } } ``` 2. **启动Spring Cloud应用**: ```java @AixCloudApplication public class AixCloudApplication { public static void main(String[] args) { AixApplication.run(AixCloudApplication.class, args); } } ``` ### 配置文件 - **aix-boot/src/main/resources/bootstrap.yml**:Spring Boot应用的基础配置。 - **aix-cloud/src/main/resources/bootstrap.yml**:Spring Cloud应用的基础配置。 ## 使用示例 ### 分页查询 ```java public class ExampleService { public Page getUsers(int pageNumber, int pageSize) { List users = userRepository.findAll(); long total = users.size(); List userDTOs = convertToDTO(users); return Page.of(pageNumber, pageSize, userDTOs, total); } } ``` ### 异常处理 ```java @RestControllerAdvice public class GlobalExceptionHandler { @ExceptionHandler(BizException.class) public Result handleBizException(BizException ex) { return Result.error(ex.getCode(), ex.getMessage()); } } ``` ### 安全配置 ```java @Configuration @EnableWebSecurity public class SecurityConfiguration { @Bean public SecurityFilterChain filterChain(HttpSecurity http) throws Exception { http .authorizeRequests() .antMatchers("/public/**").permitAll() .anyRequest().authenticated() .and() .addFilterBefore(new JwtAuthenticationTokenFilter(), UsernamePasswordAuthenticationFilter.class); return http.build(); } } ``` ### Redis缓存 ```java @Component public class RedisCache { @Autowired private RedisCache redisCache; public void setCacheObject(String key, Object value) { redisCache.setCacheObject(key, value); } public Object getCacheObject(String key) { return redisCache.getCacheObject(key); } } ``` ## 贡献指南 欢迎贡献代码和文档。请遵循以下步骤: 1. Fork仓库。 2. 创建新分支。 3. 提交代码更改。 4. 发起Pull Request。 ## 许可证 本项目采用Apache-2.0 License。详情请查看[LICENSE](LICENSE)文件。