# kenshirokk/makemoney001 architecture

> Architecture diagram of the GitHub repository kenshirokk/makemoney001, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-07). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/kenshirokk/makemoney001
- Repository: https://github.com/kenshirokk/makemoney001

## Overview

##### Main Components
- Web Layer (Controllers): Under the "controller" package, you have multiple controllers (e.g., AccountsInfoController, AgencyController, AuthController, etc.). These components receive web requests (likely REST API calls) and are the entry points for client interactions.
- Business Logic Layer (Services): The "service" packages along with their implementations in "service/impl" encapsulate the business logic. For example, LoginService and its implementation, along with service classes for managing bulletins, agency info, game configuration, and so on.
- Data Access Layer (Mappers/Repositories): The "mapper" packages (split between "adminmanager", "qpaccountsdb", and "qpplatformdb") indicate the use of MyBatis (notice the XML mapping files in the resources/mapper folders). This layer handles interactions with the underlying databases.
- Domain Model (Entities and DTO/VO): The "entity" package holds the domain models that correspond to the database tables, while the "dto" and "vo" classes in the "common" subpackages are used to transfer and present data.
- Configuration and Utilities:
- Configuration classes like MvcConfig and SwaggerConfig reside in the "config" package. They set up web MVC and API documentation.
- Utility classes (under "common/util") such as Cryptography, QrCode, and Token provide supporting functionality.
- Custom annotations (e.g., AdminMethod, PublicMethod) and interceptors (like AuthInterceptor) suggest mechanisms for authorization and logging or other cross-cutting concerns.
- Resources and Environment Settings:
- The “src/main/resources” folder holds configuration files (application.yml and its variants) and MyBatis mapper XML files, which detail SQL mappings.
- SQL scripts (found in SQL folder) further indicate where database triggers or other setup commands are maintained.
- Testing: The “src/test” directories contain corresponding tests for controllers, services, and mappers, ensuring the different layers are properly verified.

##### Mapping Relationships and Interactions
- Controllers delegate requests to Service components which perform the business logic.
- The Service layer then interacts with the Data Access Layer (Mappers) to query or update data in the database.
- A bidirectional interaction between the Service and any external utilities or configurations that enforce security (e.g., via AuthInterceptor and the custom annotations).

##### Architectural Patterns and Design Principles
- Layered architecture (Presentation, Business, Data Access).
- Use of annotations and interceptors indicates an aspect-oriented approach to handle cross-cutting concerns like authentication.
- Separation of configuration from logic, evident in the dedicated configuration classes and externalized settings.
- Use of MyBatis to abstract SQL interactions, with XML files providing data mapping.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Client
    Client["Client"]:::client

    %% Presentation Layer
    subgraph "Presentation Layer"
        Controllers["Controllers (Web Layer)\n(e.g., AccountsInfoController, AgencyController, AuthController)"]:::presentation
    end

    %% Business Logic Layer
    subgraph "Business Logic Layer"
        Services["Services\n(Business Logic & Service Implementations)"]:::business
    end

    %% Data Access Layer
    subgraph "Data Access Layer"
        JavaMappers["Java Mappers\n(MyBatis Interfaces)"]:::data
        MyBatisMappers["MyBatis Mappers (XML)"]:::data
    end

    %% Database
    DB["(Database)"]:::database

    %% Domain Model
    subgraph "Domain Model"
        Entities["Entities"]:::domain
        DTO["DTOs"]:::domain
        VO["VOs"]:::domain
    end

    %% Configuration & Utilities
    subgraph "Configuration & Utilities"
        Config["Configuration (MVC, Swagger)"]:::config
        Utilities["Utilities\n(Cryptography, QrCode, Token)"]:::config
    end

    %% Security & Interception
    subgraph "Security & Interception"
        Annotations["Custom Annotations\n(AdminMethod, PublicMethod)"]:::security
        Interceptors["AuthInterceptor"]:::security
    end

    %% Resources & Testing
    subgraph "Resources & Testing"
        Env["Environment Settings\n(application.yml etc.)"]:::resources
        SQL["SQL Scripts & Triggers"]:::resources
        Testing["Testing Infrastructure"]:::testing
    end

    %% Connections
    Client -->|"HTTP_Request"| Controllers
    Controllers -->|"Delegates_to"| Services
    Controllers -->|"Exchanges_Data_with"| DTO
    Controllers -->|"Exchanges_Data_with"| VO
    Services -->|"Executes_Business_Logic"| JavaMappers
    Services -->|"Executes_Business_Logic"| MyBatisMappers
    JavaMappers -->|"CRUD_Operations"| DB
    MyBatisMappers -->|"CRUD_Operations"| DB
    Services -->|"Operates_on"| Entities
    Services -->|"Utilizes"| Utilities
    Controllers -->|"Configured_By"| Config
    Services -->|"Configured_By"| Config
    Controllers -->|"Secured_By"| Interceptors
    Services -->|"Secured_By"| Annotations
    Env -->|"Configures"| Config
    SQL -->|"Initializes"| DB
    Testing -->|"Tests"| Controllers
    Testing -->|"Tests"| Services
    Testing -->|"Tests"| JavaMappers
    Testing -->|"Tests"| MyBatisMappers

    %% Click Events
    click Controllers "https://github.com/kenshirokk/makemoney001/tree/master/src/main/java/com/mtf/admin/controller"
    click Services "https://github.com/kenshirokk/makemoney001/tree/master/src/main/java/com/mtf/admin/service"
    click Services "https://github.com/kenshirokk/makemoney001/tree/master/src/main/java/com/mtf/admin/service/impl"
    click JavaMappers "https://github.com/kenshirokk/makemoney001/tree/master/src/main/java/com/mtf/admin/mapper"
    click MyBatisMappers "https://github.com/kenshirokk/makemoney001/tree/master/src/main/resources/mapper"
    click Entities "https://github.com/kenshirokk/makemoney001/tree/master/src/main/java/com/mtf/admin/entity"
    click DTO "https://github.com/kenshirokk/makemoney001/tree/master/src/main/java/com/mtf/admin/common/dto"
    click VO "https://github.com/kenshirokk/makemoney001/tree/master/src/main/java/com/mtf/admin/common/vo"
    click Config "https://github.com/kenshirokk/makemoney001/tree/master/src/main/java/com/mtf/admin/config"
    click Config "https://github.com/kenshirokk/makemoney001/tree/master/src/main/java/com/mtf/admin/common/config"
    click Utilities "https://github.com/kenshirokk/makemoney001/tree/master/src/main/java/com/mtf/admin/common/util"
    click Annotations "https://github.com/kenshirokk/makemoney001/tree/master/src/main/java/com/mtf/admin/common/annotation"
    click Interceptors "https://github.com/kenshirokk/makemoney001/tree/master/src/main/java/com/mtf/admin/interceptor"
    click Env "https://github.com/kenshirokk/makemoney001/tree/master/src/main/resources"
    click SQL "https://github.com/kenshirokk/makemoney001/tree/master/src/main/resources/sql"
    click Testing "https://github.com/kenshirokk/makemoney001/tree/master/src/test"

    %% Styles
    classDef client fill:#c0c0f9,stroke:#333,stroke-width:2px;
    classDef presentation fill:#fef2c0,stroke:#333,stroke-width:2px;
    classDef business fill:#c0f9d4,stroke:#333,stroke-width:2px;
    classDef data fill:#c0d9f9,stroke:#333,stroke-width:2px;
    classDef database fill:#f0c0f9,stroke:#333,stroke-width:2px;
    classDef domain fill:#f9c0c0,stroke:#333,stroke-width:2px;
    classDef config fill:#d0c0f9,stroke:#333,stroke-width:2px;
    classDef security fill:#c0f9f9,stroke:#333,stroke-width:2px;
    classDef resources fill:#f9e0c0,stroke:#333,stroke-width:2px;
    classDef testing fill:#e0f9c0,stroke:#333,stroke-width:2px;
```
