How kualk4410/dormitorymanagesystem works
Project Type and Purpose
• This is a full-stack web application named “DMS” (Dormitory Management System).
• Front-end: Vue3 single-page application (SPA) built with Vite, Element-Plus, and static asset handling.
• Back-end: Spring Boot monolith exposing RESTful APIs, layered as Controller → Service → MyBatis Mapper → MySQL.
• Database: MySQL 8.0, with ORM via MyBatis.
• External integrations: weather API, dorm water/electricity data API.
• File storage: image upload for cleaning records (likely on local disk or object storage).
High-Level Components
a. Client Layer
• Browser / Mobile Web.
• Vue3 SPA (components, router, utils/java_request.js).
• UI modules: Login, Index, Member, Record (E‐water, Labor, Photo, Rule), etc.
b. API Layer
• Spring Boot REST controllers (EwaterController, LaborController, RuleController, StudentController, TitleController).
• JWT‐based auth handled by JwtUtil and LoginInterceptor.
c. Business Layer
• Service interfaces (EwaterService, LaborService, …) and implementations.
• Utility classes (Md5Util, ThreadLocalUtil).
d. Data Access Layer
• MyBatis mappers (EwaterMapper, LaborMapper, …).
• POJOs representing tables (Ewater, Labor, Rule, Student, Title).
e. Persistence
• MySQL database.
• Schema: student, dorm, rule, clean_task, expense, event, repair_order, log tables.
f. External Services
• Weather forecasting API.
• University water/electricity usage API.
g. File Storage
• Uploaded images for cleaning records (could be local or cloud).
h. Logging
• Application logs stored under .DMS/log (daily log files).
i. DevOps (optional to show)
• Git branches (main/dev).
• Build tools: Maven (pom.xml), npm (package.json).
• Deployment artifacts: application.yml, Vite config.
Relationships and Interactions
• User’s browser sends HTTP(S) requests to the Vue SPA.
• SPA makes AJAX calls (java_request.js) carrying JWT tokens to Spring Boot REST endpoints.
• LoginInterceptor validates JWT; JwtUtil issues tokens on login.
• Controllers orchestrate requests to Service layer.
• Services enforce business rules (cleaning management, duty rotation, proposals, logs).
• Services call MyBatis Mappers to execute SQL against MySQL.
• For image uploads, backend stores files and returns URLs to front-end.
• Scheduled or on-demand tasks fetch data from external weather and utility APIs.
• Logs are appended to .DMS/log files.
Architectural Patterns and Principles
• Layered architecture: Presentation (Vue) → API (Controller) → Business (Service) → Data (Mapper) → Persistence.
• MVC on back-end: Controllers + Views (JSON) + Models (POJOs).
• Token-based stateless authentication (JWT).
• Configuration via application.yml.
• RESTful design: Resource controllers per entity.
• Modular front-end: Separation of Base components vs. feature-specific components.
• Low coupling: Front-end ↔ back-end via defined interfaces; back-end ↔ DB via MyBatis.
• High cohesion: Each service & mapper handles a single domain.