# battleislife/java_quanlithuvienhvnh architecture

> Architecture diagram of the GitHub repository battleislife/java_quanlithuvienhvnh, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-30). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/battleislife/java_quanlithuvienhvnh
- Repository: https://github.com/battleislife/java_quanlithuvienhvnh

## Overview

This is a Swing desktop library-management application backed by MySQL. Its user workflow starts at login, opens the main application, and supports catalog, borrower, circulation, fine, staff, and shift management; settings and statistics are additional capabilities visible in the source tree. The sampled code shows controllers invoking DAOs, shared JDBC access, and permission checks. Several feature implementations are unsampled, so their internal links are omitted rather than inferred; the README provides no further architecture detail.

Main entry points: [`src/controller/NhanVienController.java`](https://github.com/battleislife/java_quanlithuvienhvnh/blob/dat_branch/src/controller/NhanVienController.java) (Staff management), [`src/controller/PhieuPhatController.java`](https://github.com/battleislife/java_quanlithuvienhvnh/blob/dat_branch/src/controller/PhieuPhatController.java) (Fine management), [`src/dao/BaseDAO.java`](https://github.com/battleislife/java_quanlithuvienhvnh/blob/dat_branch/src/dao/BaseDAO.java) (Shared DAO access), [`src/view/SachForm.java`](https://github.com/battleislife/java_quanlithuvienhvnh/blob/dat_branch/src/view/SachForm.java) (Books)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Application entry"]
  node_launcher["Desktop launcher<br/>[App.java]"]
  node_login["Login<br/>[LoginForm.java]"]
  node_authservice["Staff lookup service"]
  node_mainapp["Main application"]
end

subgraph group_circulation["Library operations"]
  node_borrowers["Borrowers"]
  node_loans["Loan management<br/>[PhieuMuonForm.java]"]
  node_loanrecords["Loan records<br/>[PhieuMuonDAO.java]"]
  node_loanitems["Loan details"]
  node_fines["Fine management"]
  node_fineform["Fine interface<br/>[PhieuPhatForm.java]"]
end

subgraph group_catalog["Catalog management"]
  node_catalogbooks["Books<br/>[SachForm.java]"]
  node_publishers["Publishers<br/>[NhaXuatBanDAO.java]"]
  node_authors["Authors<br/>[TacGiaDAO.java]"]
  node_genres["Genres<br/>[TheLoaiDAO.java]"]
end

subgraph group_admin["Staff administration"]
  node_staff["Staff management"]
  node_shifts["Shift management"]
  node_settings["Settings"]
  node_reports["Statistics<br/>[PanelThongKe.java]"]
  node_permissions["Permission checks"]
end

subgraph group_data["Persistence and models"]
  node_daobase["Shared DAO access<br/>[BaseDAO.java]"]
  node_dbconnection["JDBC connection<br/>[DBConnection.java]"]
  node_database[("MySQL database")]
  node_domainmodels["Domain models"]
end

node_user(("Staff user"))

node_user -->|"starts"| node_launcher
node_launcher -->|"opens"| node_login
node_login -->|"checks credentials"| node_authservice
node_login -->|"opens on success"| node_mainapp
node_authservice -->|"uses staff DAO"| node_staff
node_loans -->|"loads and saves"| node_loanrecords
node_fines -->|"updates interface"| node_fineform
node_fines -->|"looks up borrowers"| node_borrowers
node_fines -->|"looks up staff"| node_staff
node_fines -->|"checks access"| node_permissions
node_catalogbooks -->|"loads publisher data"| node_publishers
node_catalogbooks -->|"loads author data"| node_authors
node_catalogbooks -->|"loads genre data"| node_genres
node_staff -->|"checks access"| node_permissions
node_shifts -->|"checks access"| node_permissions
node_shifts -->|"loads staff records"| node_staff
node_daobase -->|"opens connections"| node_dbconnection
node_dbconnection -->|"connects"| node_database
node_loanrecords -->|"uses shared queries"| node_daobase
node_loanitems -.->|"uses shared queries"| node_daobase
node_borrowers -.->|"uses shared queries"| node_daobase
node_domainmodels -.->|"staff data types"| node_staff

click node_launcher "https://github.com/battleislife/java_quanlithuvienhvnh/blob/dat_branch/src/App.java"
click node_login "https://github.com/battleislife/java_quanlithuvienhvnh/blob/dat_branch/src/view/LoginForm.java"
click node_authservice "https://github.com/battleislife/java_quanlithuvienhvnh/blob/dat_branch/src/service/NhanVienService.java"
click node_mainapp "https://github.com/battleislife/java_quanlithuvienhvnh/blob/dat_branch/src/view/MainApplication.java"
click node_borrowers "https://github.com/battleislife/java_quanlithuvienhvnh/blob/dat_branch/src/controller/NguoiMuonController.java"
click node_loans "https://github.com/battleislife/java_quanlithuvienhvnh/blob/dat_branch/src/view/PhieuMuonForm.java"
click node_loanrecords "https://github.com/battleislife/java_quanlithuvienhvnh/blob/dat_branch/src/dao/PhieuMuonDAO.java"
click node_loanitems "https://github.com/battleislife/java_quanlithuvienhvnh/blob/dat_branch/src/dao/ChiTietPhieuMuonDAO.java"
click node_fines "https://github.com/battleislife/java_quanlithuvienhvnh/blob/dat_branch/src/controller/PhieuPhatController.java"
click node_fineform "https://github.com/battleislife/java_quanlithuvienhvnh/blob/dat_branch/src/view/PhieuPhatForm.java"
click node_catalogbooks "https://github.com/battleislife/java_quanlithuvienhvnh/blob/dat_branch/src/view/SachForm.java"
click node_publishers "https://github.com/battleislife/java_quanlithuvienhvnh/blob/dat_branch/src/dao/NhaXuatBanDAO.java"
click node_authors "https://github.com/battleislife/java_quanlithuvienhvnh/blob/dat_branch/src/dao/TacGiaDAO.java"
click node_genres "https://github.com/battleislife/java_quanlithuvienhvnh/blob/dat_branch/src/dao/TheLoaiDAO.java"
click node_staff "https://github.com/battleislife/java_quanlithuvienhvnh/blob/dat_branch/src/controller/NhanVienController.java"
click node_shifts "https://github.com/battleislife/java_quanlithuvienhvnh/blob/dat_branch/src/controller/CaLamController.java"
click node_settings "https://github.com/battleislife/java_quanlithuvienhvnh/blob/dat_branch/src/controller/CaiDatController.java"
click node_reports "https://github.com/battleislife/java_quanlithuvienhvnh/blob/dat_branch/src/view/components/PanelThongKe.java"
click node_permissions "https://github.com/battleislife/java_quanlithuvienhvnh/blob/dat_branch/src/utilities/PermissionUtil.java"
click node_daobase "https://github.com/battleislife/java_quanlithuvienhvnh/blob/dat_branch/src/dao/BaseDAO.java"
click node_dbconnection "https://github.com/battleislife/java_quanlithuvienhvnh/blob/dat_branch/src/config/DBConnection.java"
click node_domainmodels "https://github.com/battleislife/java_quanlithuvienhvnh/tree/dat_branch/src/model"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_launcher,node_login,node_authservice,node_mainapp,node_user toneBlue
class node_borrowers,node_loans,node_loanrecords,node_loanitems,node_fines,node_fineform toneAmber
class node_catalogbooks,node_publishers,node_authors,node_genres toneMint
class node_staff,node_shifts,node_settings,node_reports,node_permissions toneRose
class node_daobase,node_dbconnection,node_database,node_domainmodels toneIndigo
```

## Components

### Application entry

- [Desktop launcher](https://github.com/battleislife/java_quanlithuvienhvnh/blob/dat_branch/src/App.java): `src/App.java`
- [Login](https://github.com/battleislife/java_quanlithuvienhvnh/blob/dat_branch/src/view/LoginForm.java): `src/view/LoginForm.java`
- [Staff lookup service](https://github.com/battleislife/java_quanlithuvienhvnh/blob/dat_branch/src/service/NhanVienService.java): `src/service/NhanVienService.java`
- [Main application](https://github.com/battleislife/java_quanlithuvienhvnh/blob/dat_branch/src/view/MainApplication.java): `src/view/MainApplication.java`

### Library operations

- [Borrowers](https://github.com/battleislife/java_quanlithuvienhvnh/blob/dat_branch/src/controller/NguoiMuonController.java): `src/controller/NguoiMuonController.java`
- [Loan management](https://github.com/battleislife/java_quanlithuvienhvnh/blob/dat_branch/src/view/PhieuMuonForm.java): `src/view/PhieuMuonForm.java`
- [Loan records](https://github.com/battleislife/java_quanlithuvienhvnh/blob/dat_branch/src/dao/PhieuMuonDAO.java): `src/dao/PhieuMuonDAO.java`
- [Loan details](https://github.com/battleislife/java_quanlithuvienhvnh/blob/dat_branch/src/dao/ChiTietPhieuMuonDAO.java): `src/dao/ChiTietPhieuMuonDAO.java`
- [Fine management](https://github.com/battleislife/java_quanlithuvienhvnh/blob/dat_branch/src/controller/PhieuPhatController.java): `src/controller/PhieuPhatController.java`
- [Fine interface](https://github.com/battleislife/java_quanlithuvienhvnh/blob/dat_branch/src/view/PhieuPhatForm.java): `src/view/PhieuPhatForm.java`

### Catalog management

- [Books](https://github.com/battleislife/java_quanlithuvienhvnh/blob/dat_branch/src/view/SachForm.java): `src/view/SachForm.java`
- [Publishers](https://github.com/battleislife/java_quanlithuvienhvnh/blob/dat_branch/src/dao/NhaXuatBanDAO.java): `src/dao/NhaXuatBanDAO.java`
- [Authors](https://github.com/battleislife/java_quanlithuvienhvnh/blob/dat_branch/src/dao/TacGiaDAO.java): `src/dao/TacGiaDAO.java`
- [Genres](https://github.com/battleislife/java_quanlithuvienhvnh/blob/dat_branch/src/dao/TheLoaiDAO.java): `src/dao/TheLoaiDAO.java`

### Staff administration

- [Staff management](https://github.com/battleislife/java_quanlithuvienhvnh/blob/dat_branch/src/controller/NhanVienController.java): `src/controller/NhanVienController.java`
- [Shift management](https://github.com/battleislife/java_quanlithuvienhvnh/blob/dat_branch/src/controller/CaLamController.java): `src/controller/CaLamController.java`
- [Settings](https://github.com/battleislife/java_quanlithuvienhvnh/blob/dat_branch/src/controller/CaiDatController.java): `src/controller/CaiDatController.java`
- [Statistics](https://github.com/battleislife/java_quanlithuvienhvnh/blob/dat_branch/src/view/components/PanelThongKe.java): `src/view/components/PanelThongKe.java`
- [Permission checks](https://github.com/battleislife/java_quanlithuvienhvnh/blob/dat_branch/src/utilities/PermissionUtil.java): `src/utilities/PermissionUtil.java`

### Persistence and models

- [Shared DAO access](https://github.com/battleislife/java_quanlithuvienhvnh/blob/dat_branch/src/dao/BaseDAO.java): `src/dao/BaseDAO.java`
- [JDBC connection](https://github.com/battleislife/java_quanlithuvienhvnh/blob/dat_branch/src/config/DBConnection.java): `src/config/DBConnection.java`
- **MySQL database**
- [Domain models](https://github.com/battleislife/java_quanlithuvienhvnh/tree/dat_branch/src/model): `src/model`

### Other components

- **Staff user**

## Connections

- Staff user → Desktop launcher: starts (evidence: `src/App.java`)
- Desktop launcher → Login: opens (evidence: `src/App.java`)
- Login → Staff lookup service: checks credentials (evidence: `src/view/LoginForm.java`)
- Login → Main application: opens on success (evidence: `src/view/LoginForm.java`)
- Staff lookup service → Staff management: uses staff DAO (evidence: `src/service/NhanVienService.java`)
- Loan management → Loan records: loads and saves (evidence: `src/view/PhieuMuonForm.java`)
- Fine management → Fine interface: updates interface (evidence: `src/controller/PhieuPhatController.java`)
- Fine management → Borrowers: looks up borrowers (evidence: `src/controller/PhieuPhatController.java`)
- Fine management → Staff management: looks up staff (evidence: `src/controller/PhieuPhatController.java`)
- Fine management → Permission checks: checks access (evidence: `src/controller/PhieuPhatController.java`)
- Books → Publishers: loads publisher data (evidence: `src/view/SachForm.java`)
- Books → Authors: loads author data (evidence: `src/view/SachForm.java`)
- Books → Genres: loads genre data (evidence: `src/view/SachForm.java`)
- Staff management → Permission checks: checks access (evidence: `src/controller/NhanVienController.java`)
- Shift management → Permission checks: checks access (evidence: `src/controller/CaLamController.java`)
- Shift management → Staff management: loads staff records (evidence: `src/controller/CaLamController.java`)
- Shared DAO access → JDBC connection: opens connections (evidence: `src/dao/BaseDAO.java`)
- JDBC connection → MySQL database: connects (evidence: `src/config/DBConnection.java`)
- Loan records → Shared DAO access: uses shared queries (evidence: `src/dao/PhieuMuonDAO.java`)
- Loan details → Shared DAO access: uses shared queries
- Borrowers → Shared DAO access: uses shared queries
- Domain models → Staff management: staff data types (evidence: `src/controller/NhanVienController.java`)
