You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

3.5 KiB

Repository Guidelines

Project Structure & Module Organization

This repository is a multi-module RuoYi backend. ruoyi-admin is the Spring Boot entrypoint and owns runtime config in src/main/resources/application.yml. Shared capabilities live in ruoyi-common, infrastructure and security wiring in ruoyi-framework, system master data in ruoyi-system, scheduled jobs in ruoyi-quartz, code generation in ruoyi-generator, and energy-management business code in ruoyi-ems. SQL assets belong in sql/. Add new code to the nearest existing module instead of overloading ruoyi-admin.

Technology Stack

The current stack is Spring Boot 3.x with Spring MVC, Spring Security, Validation, Redis, and Quartz. Persistence uses MyBatis 3.5.x plus MyBatis-Plus 3.5.x with XML mappers under src/main/resources/mapper/**. Other confirmed dependencies include Druid, MySQL Connector/J, Springdoc OpenAPI, Fastjson2, Apache POI, Lombok, Elasticsearch 7.14, Easy-ES 2.0, and Velocity-based code generation. Example startup command: mvn -pl ruoyi-admin -am spring-boot:run.

Common Utilities & Framework Conventions

ruoyi-common already provides reusable annotations such as @Log, @DataScope, @Excel, @RateLimiter, and @RepeatSubmit. Prefer built-in helpers before adding new utilities: SecurityUtils, RedisCache, ExcelUtil, DateUtils, StringUtils, PageUtils, DictUtils, FileUploadUtils, and SqlUtil. ruoyi-framework centralizes security, dynamic datasource, MyBatis-Plus config, request filters, async manager, and global web exception handling. Reuse these capabilities instead of duplicating cross-cutting logic in business modules.

EMS Module Scope

ruoyi-ems is organized by business domain: base, info, record, and report. base covers energy type, energy price, share price, monitoring point, threshold, work unit, collection device, and alarm action configuration. info handles daily fault records, fault handling, spare-parts registration and inventory, inventory checks, UPS and luggage-system battery lifecycle, and supervision checklists. record stores real-time and alarm data, including water, steam, electric, vibration, temperature, and IoT environment records. report provides point reports plus statistical and peak/valley consumption reporting.

Build, Test, and Development Commands

  • mvn clean install -DskipTests : build all discovered modules.
  • mvn -pl ruoyi-admin -am package : package the deployable admin artifact.
  • mvn -pl ruoyi-admin -am spring-boot:run : run locally on port 9081.
  • mvn test : run unit tests after adding or updating them.

Coding Style & Naming Conventions

Use 4-space indentation, UTF-8, com.ruoyi package names, and one public class per file. Follow the existing layering pattern: controller, service, service.impl, mapper, domain, resources/mapper. Use UpperCamelCase for classes and lowerCamelCase for members; keep names explicit, for example EmsBaseMonitorInfoController or IEmsReportService.

Testing, Commit, and Security Notes

No src/test directories are present yet, so new features should add focused tests where practical, especially for permissions, mapper SQL branches, and report calculations. Git history is unavailable in this workspace, so prefer clear conventional commits such as feat(ems): add spare parts inventory check export. Do not commit real Redis hosts, passwords, tokens, or file-storage paths from application.yml; externalize environment-specific values before sharing branches or opening PRs.