How diweikang2019/smart-admin works
Main Components
• Back End: The back-end code is located in the “smart-admin-api-java8-springboot2” directory. It is split into at least two Maven modules:
– sa-admin: Contains business modules for system functionalities (e.g., business modules for category, goods, OA (office automation), system modules like login, employee, menu, and role management).
– sa-base: This holds the common utilities, shared configuration, common exception handling, and core aspects (such as JSON conversion, swagger support, security configurations, code generator support, etc.).
• Database: Represent the persistence layer where Mybatis-Plus is used to map domain objects, and mappers are located in “src/main/resources/mapper”. The database is central to storing business data and system parameters.
• External/Supporting Services: Illustrate integration with additional services like Sa-Token (for security/session management), encryption (API encrypt/decrypt), and logging or monitoring (operate log, login log, heartbeat) systems. Also, show configuration profiles (dev, pre, test, prod) that are managed through different YAML and XML configuration files.
Internal Layered Architecture in the Back End
• Controller Layer: In each module (in sa-admin, for example) the REST controllers (such as CategoryController, GoodsController, and numerous system management controllers) receive HTTP requests.
• Service Layer: This layer houses business logic; it is responsible for handling operations of both business modules and support modules (data scope, file management, etc.).
• Manager Layer: Note that the project practices a “four-layer architecture” – Manager classes (such as EmployeeManager, RoleEmployeeManager) sit between the service and DAO layers to manage complex business logic and transactions.
• Data Access Layer (DAO): The DAOs interact directly with database mapper XMLs and Mybatis configuration files.
Cross-Cutting and Configuration Components
• Configuration and Environment Support: Emphasize the multiple configuration profiles (development, pre, prod, and test) and common shared configurations in the sa-base module.
• Code Generation and Support Utilities: The project also supports an online code generator that auto-generates controllers, DAOs, and configuration templates (look at the code-generator packages and corresponding templates under resources).
Data Flow and Dependencies
• Within the back end, indicate that controllers call services, which in turn delegate to managers and then to DAOs for persistence.
• That DAO operations rely on mapper XMLs and Mybatis (pointing to the “mapper” folders in resources).
Notate Key Technologies
• That the back end is built in Java8 or Java17, using SpringBoot2/3, with Sa-Token for security and Mybatis-Plus for ORM.
• The front end is built with Vue3 and Vite5 plus integrations with Ant Design Vue and Pinia.