How layheng-hok/shenzhen-metro works
Project Type and Purpose
• This project is a metro management system developed as part of a university database course. It has two clear components:
• Part 2 implements an API using Spring Boot with clearly defined controllers, DTOs, services, and repositories, along with a basic web interface to interact with the system.
Main Components
a. Data Import and Database Design Subsystem:
• Java-based Import Scripts (located in the ShenzhenMetroDatabaseDesign and the updated DataImport directories).
• Python-based Import Script for data import automation.
• Resources containing JSON data files and SQL DDLs (MySQL and PostgreSQL).
• Underlying Database(s): Illustrate both options (PostgreSQL and MySQL) even though the API deployment instructs MySQL.
b. API and Backend Service:
• The Spring Boot Application (Project2/ShenzhenMetro) that serves as the primary backend.
• Layers such as:
• Controller layer: REST endpoints (e.g., BusController, StationController, RideController).
• DTO layer: Data Transfer Objects that smooth data exchange between client and server.
• Service layer: Business logic implementations (e.g., RideService, LineDetailService).
• Repository layer: Data access interfaces (e.g., CardRepository, StationRepository).
• Integration with the previously designed and populated database.
c. Frontend / Static Views:
• Static assets (HTML, CSS, JavaScript) and templates that provide the user interface for administrative or user operations.
• Separation between static resources (web assets) and the backend API.
d. External Systems / Environment:
• The database system (MySQL is used for deployment, while experiments are also conducted on PostgreSQL).
• Deployment environments: note testing on different OSs (macOS, Windows, Linux VM) as reported in the experiments.
• Build and configuration tools such as Maven, IDEs like IDEA and PyCharm.
Relationships and Interactions
• How the Spring Boot Application’s controllers receive requests that flow through service logic, which in turn interacts with the database via repositories.
• Data flow from the database back to the frontend via the API calls.
• Modular separation: data import is a distinct process from the ongoing API services, although both ultimately target the same database.
Architectural Patterns and Technologies
• For the backend (Spring Boot application), include the common layered architecture (Controller, Service, Repository, DTO).
• Stress the use of ORM-like mapping in the “object” package that maps database tables into Java objects.
• Mention the usage of standard integration patterns such as PreparedStatement batching (for performance in data import) and RESTful API design in the Spring Boot project.
• Rectangles for components (e.g., Import Scripts, Application Server).
Final Checklist
• All major components must be clearly identified and labeled.
• That both parts of the project are represented while showing how they interact with the shared database.
• Keep details comprehensive but focused on architectural elements rather than low-level code details.