English | 中文说明
A simple library borrowing system built with Spring Boot + MyBatis-Plus + MariaDB on the backend and static HTML + Axios on the frontend. JWT-based auth is handled by a custom interceptor. Frontend is served via a lightweight HTTP server.
library/- Spring Boot backendlibrary-frontend/- static frontend (HTML/JS/CSS)database/init.sql- schema and seed dataMarkdown/- training handouts (Chinese)
- JDK 17+
- Maven
- MariaDB/MySQL
- Python 3 (for simple static server)
- Database
mariadb -u <user> -p < /home/instreaman/Code/library-system/database/init.sqlDatabase: library_db (default credentials in application.yml: user library, password library123).
- Backend
cd library
mvn spring-boot:runRuns on http://localhost:8080.
- Frontend
cd library-frontend
python -m http.server 5500Open http://localhost:5500/pages/login.html (auto-redirects from index.html).
- Admin:
admin/admin123 - User:
user1/user123
- JWT helper:
JwtUtils - Login interceptor writes
userId,username,roleto request attributes. - Borrowing APIs (
/api/user/**) manage bothavailable_quantityandborrowed_quantityatomically. - Entity/table names:
book,user,borrow_record.
- API base URL is set in
library-frontend/js/config.js(http://localhost:8080/api). - Auth token stored under
library_token(localStorage). - User pages:
pages/user/books.html(my borrows) andpages/user/borrow_book.html(available books). - Admin pages:
pages/admin/books.html(book CRUD) andpages/admin/book_record.html(book borrow history).
VS Code tasks (already configured):
- Start backend: Maven
spring-boot:runinlibrary - Start frontend:
python -m http.server 5500inlibrary-frontend - Stop tasks: see
.vscode/tasks.json
- Login as admin, manage books.
- Login as user, borrow a book, verify
available_quantitydecreases andborrowed_quantityincreases. - Return the book, verify counts revert.
- Check browser Network/Console for 401 or CORS issues.
MIT