# wameeee/onlineauctions architecture

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

- Interactive diagram: https://gitdiagram.com/wameeee/onlineauctions
- Repository: https://github.com/wameeee/onlineauctions

## Overview

##### Project type and purpose
- This is a Java-based online auction web application (Servlet/JSP) with MyBatis for persistence and MySQL as the database.
- It implements core user functionality (register, login, browse, bid) and admin functionality (manage auctions, users, records).

##### File structure
- Top-level:
- pom.xml, create_auction.sql, README.md
- src/main/java/.../web – Servlets and filters (AuthFilter, AuctionServlet, UserServlet).
- src/main/java/.../service + impl – Business logic layer.
- src/main/java/.../mapper – MyBatis mapper interfaces & XML in resources.
- src/main/java/.../entity – Domain model (Auction, AuctionUser, AuctionRecord).
- src/main/java/.../util – Utilities (MyBatisUtil, PasswordUtil).
- src/main/webapp – JSP pages, static assets (css, js, images).
- src/main/resources – MyBatis config, Log4j, mapper XML files.
- Pattern: Classic MVC layered architecture (Controller → Service → DAO → DB), deployed in a Tomcat container.

##### README for additional insights
- Confirms Java8, Servlet/JSP, MyBatis, MySQL, Tomcat9.
- Database tables: auction, auctionUser, auctionRecord.
- Deployment via Maven/Tomcat7 plugin.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Client Layer
    Browser("Web Browser"):::ui
    Browser -->|"HTTP Request"| Tomcat

    %% Build & Deployment
    Maven["Maven (pom.xml)"]:::infra
    Maven -->|"Build WAR"| Tomcat

    %% Tomcat Container Layer
    subgraph "Tomcat Web Container"
        direction TB

        %% Configuration
        WebConfig["web.xml"]:::config
        WebConfig --> AuthFilter

        %% Filter
        AuthFilter["AuthFilter"]:::server
        AuthFilter --> AuctionServlet
        AuthFilter --> UserServlet

        %% Controllers
        AuctionServlet["AuctionServlet"]:::server
        UserServlet["UserServlet"]:::server

        AuctionServlet -->|"calls"| AuctionService
        UserServlet -->|"calls"| AuctionUserService

        %% Business Layer
        subgraph "Service Layer"
            direction TB
            AuctionService["AuctionServiceImpl"]:::server
            AuctionUserService["AuctionUserServiceImpl"]:::server
            AuctionRecordService["AuctionRecordServiceImpl"]:::server
        end

        AuctionService -->|"uses"| AuctionMapper
        AuctionUserService -->|"uses"| AuctionUserMapper
        AuctionRecordService -->|"uses"| AuctionRecordMapper

        %% Persistence Layer
        subgraph "Persistence Layer (MyBatis)"
            direction TB
            MyBatisUtil["MyBatisUtil"]:::util
            AuctionMapper["AuctionMapper"]:::server
            AuctionUserMapper["AuctionUserMapper"]:::server
            AuctionRecordMapper["AuctionRecordMapper"]:::server
            MyBatisConfig["mybatis-config.xml"]:::config
            Log4jConfig["log4j.properties"]:::config
        end

        AuctionMapper -->|"SQL Session"| MySQL
        AuctionUserMapper -->|"SQL Session"| MySQL
        AuctionRecordMapper -->|"SQL Session"| MySQL

        %% View Layer
        subgraph "View Layer (JSP & Static)"
            direction TB
            JSP["JSP Pages"]:::ui
            Static["Static Assets (CSS/JS/Images)"]:::ui
        end

        AuctionServlet -->|"forwards to"| JSP
        UserServlet -->|"forwards to"| JSP
        Static -->|"served by"| Tomcat
    end

    %% Database Layer
    MySQL["MySQL Database"]:::db

    %% Entities
    subgraph "Domain Entities"
        direction TB
        AuctionEntity["Auction"]:::server
        UserEntity["AuctionUser"]:::server
        RecordEntity["AuctionRecord"]:::server
    end

    MySQL -->|"reads/writes"| AuctionEntity
    MySQL -->|"reads/writes"| UserEntity
    MySQL -->|"reads/writes"| RecordEntity

    %% Utility
    LogUtil["PasswordUtil"]:::util
    LogUtil --> AuctionUserService

    %% Click events
    click AuthFilter "https://github.com/wameeee/onlineauctions/blob/master/src/main/java/cn/wameeee/web/filter/AuthFilter.java"
    click AuctionServlet "https://github.com/wameeee/onlineauctions/blob/master/src/main/java/cn/wameeee/web/AuctionServlet.java"
    click UserServlet "https://github.com/wameeee/onlineauctions/blob/master/src/main/java/cn/wameeee/web/UserServlet.java"
    click JSP "https://github.com/wameeee/onlineauctions/blob/master/src/main/webapp/index.jsp"
    click Static "https://github.com/wameeee/onlineauctions/blob/master/src/main/webapp/css/common.css"
    click AuctionService "https://github.com/wameeee/onlineauctions/blob/master/src/main/java/cn/wameeee/service/impl/AuctionServiceImpl.java"
    click AuctionUserService "https://github.com/wameeee/onlineauctions/blob/master/src/main/java/cn/wameeee/service/impl/AuctionUserServiceImpl.java"
    click AuctionRecordService "https://github.com/wameeee/onlineauctions/blob/master/src/main/java/cn/wameeee/service/impl/AuctionRecordServiceImpl.java"
    click AuctionMapper "https://github.com/wameeee/onlineauctions/blob/master/src/main/java/cn/wameeee/mapper/AuctionMapper.java"
    click AuctionUserMapper "https://github.com/wameeee/onlineauctions/blob/master/src/main/java/cn/wameeee/mapper/AuctionUserMapper.java"
    click AuctionRecordMapper "https://github.com/wameeee/onlineauctions/blob/master/src/main/java/cn/wameeee/mapper/AuctionRecordMapper.java"
    click MyBatisConfig "https://github.com/wameeee/onlineauctions/blob/master/src/main/resources/mybatis-config.xml"
    click Log4jConfig "https://github.com/wameeee/onlineauctions/blob/master/src/main/resources/log4j.properties"
    click RecordEntity "https://github.com/wameeee/onlineauctions/blob/master/src/main/java/cn/wameeee/entity/AuctionRecord.java"
    click AuctionEntity "https://github.com/wameeee/onlineauctions/blob/master/src/main/java/cn/wameeee/entity/Auction.java"
    click UserEntity "https://github.com/wameeee/onlineauctions/blob/master/src/main/java/cn/wameeee/entity/AuctionUser.java"
    click MyBatisUtil "https://github.com/wameeee/onlineauctions/blob/master/src/main/java/cn/wameeee/util/MyBatisUtil.java"
    click LogUtil "https://github.com/wameeee/onlineauctions/blob/master/src/main/java/cn/wameeee/util/PasswordUtil.java"
    click WebConfig "https://github.com/wameeee/onlineauctions/blob/master/src/main/webapp/WEB-INF/web.xml"
    click Maven "https://github.com/wameeee/onlineauctions/blob/master/pom.xml"

    %% Styles
    classDef ui fill:#f9f,stroke:#333,stroke-width:1px
    classDef server fill:#bbf,stroke:#333,stroke-width:1px
    classDef db fill:#bfb,stroke:#333,stroke-width:1px
    classDef infra fill:#ddd,stroke:#333,stroke-width:1px
    classDef util fill:#ffb,stroke:#333,stroke-width:1px
    classDef config fill:#fcf,stroke:#333,stroke-width:1px
```
