Design Document of Library Management System
Development environment
- win10
- IDEA2019
- MAVEN
- TOMCAT9
- Mysql 8.0
- SpringMVC framework
- The front end uses bootstrap rendering
- UML system abstraction
Application background
Design a book borrowing management system for book management. If you want to borrow a book, students log in to the system and submit the book you want to borrow. If you want to return the book, the student logs in to the system to confirm the return of the book, the system calculates whether it is overdue, and if it is overdue, a fine is displayed. In addition, students can donate books to the library.
Librarians can check the status of all books borrowed by students, and can also modify the information of books and add or delete books.
demand analysis
To design a small library management system, the following functions need to be provided:
- Input data for legality verification
- The database password field should be encrypted
- Enter the student ID and return to the student loan list
- Enter [book title], you can borrow books
- Click the Book Return button to return the book.
Database abstraction
student
As a type of entity in the database, it has the following three types of attributes:
- Student ID [int type primary key]
- Name 【
varchar类型
】 - Password 【
varchar类型
】
Create a new student table in the database to manage student information.
books
As a type of entity in the database, it has the following three types of attributes:
- Book number [int primary key]
- Title 【
varchar
】 - Quantity 【
varchar
】 - Book description 【
varchar
】
Create a new book table in the database to manage books.
Borrowing table
According to BCNF
the design principles, to eliminate the transfer function dependence and partial function dependence of the non-main attribute of the database on the main attribute, a new borrowing table is needed to save the library's borrowing information.
-
stu_id: Identify the borrowing user, foreign key constraint
-
book_id: Identifies the book number borrowed, foreign key constraint
-
timestamp
: Borrowing time
System abstraction
The following is a system abstract modeling of the library according to class diagrams, use case diagrams, sequence diagrams, activity diagrams, and state diagrams, each of which represents a different perspective or viewpoint.
Class Diagram
Describe the object classes in the system and the relationships between classes
Class diagram description:
It can be seen that this is a layered architecture: the bottom pojo
layer is responsible for packaging the data in the database, the DAO(Data Access Object)
layer covers the addition, deletion and modification of the database, the service layer is used to realize the business, and the controller layer receives the front-end request and executes the corresponding business.
pojo
Layer: Each class corresponds to a table in the databaseDAO
Layer: Contains two interfaces for operating students and books.- Service layer: composed of DAO layers
- Controller layer: It is formed by aggregation of service layer.
Use case diagram
Describe the interaction between the system and its environment
Participants | Ordinary users, administrators |
---|---|
description: | Readers: You can query book information and donate books through the Internet, and readers can borrow and return books. Ordinary administrator: manage the back-end library, reader library, and database. |
data: | Number, title, description of books; borrowing of books |
Trigger mechanism | Participants make requests |
response | Confirmation information that the library management system has been updated |
Timing diagram
Describe the interaction between the participant and the system directly and the system construction
Ordinary user operation sequence :
-
Readers log in to the reader account:
First execute the login () method to enter the user name and password, and execute the checkId () method to verify the correctness of the user name. If illegal characters are entered, login failure will be returned; if it is correct, the checkPassword () method will continue to be executed; if the password is entered incorrectly, login failure will be returned. If the password is correct, the login is successful.
-
Query new books in storage:
Readers can search for new books in the library by using the book title.
-
Borrow a book
Readers can choose to borrow books or renew books when borrowing books; when borrowing books, readers query the desired books and use the
gotoBorrowBook()
jump toborrowBook()
method to generate borrowing records. If the loan is successful, the loan record will be generated successfully. If the inventory is insufficient, the loan will be returned; -
Return books
Book Return: Readers return books, which are divided into normal book return and abnormal book return. When the book is returned normally, the reader queries the book record and selects the book to be returned. First, the
gotoreturn()
method callreturnBook()
method is executed to delete the book record. If it is normal, the book return is successful and a book return record is generated. If overdue, you need to pay a fine before you can return the book. -
Enquire about personal borrowing
Readers query personal information, first execute the
queryBookByStu()
method to query the book that the individual has borrowed.
Librarian's operation sequence:
-
New book storage
After logging in to the system, the librarian chooses to add the book function and start the execution
gotoAddBook()
method. This method will call the New_Book class toaddBook()
add the new book. -
Obsolete
Click the delete button on the front-end interface and the background controller will execute the
deleteBook()
method to delete the book. -
Book update
The administrator has the authority to execute the
updateBook()
method to update the book information. -
View reader subscriptions
Select to view the reader subscription, that is, the implementation
queryBookByStu
method, that is, to obtain the corresponding reader subscription information.
Activity diagram
Describe the activities involved in the process or data processing
State diagram
Describe how the system responds to external events
、
Instructions for use
general user
After the system is running, first enter the user login interface, the user login interface, unregistered users need to register first.
registered
Click to Register
enter the registration page and fill in the relevant information to register. After successful registration, return to the login interface.
log in
Enter the user name and password and click login, select remember me
to remember the account password.
Borrow a book
Search by book title keywords, select to borrow books.
Return books
To read your own reader information and books you have borrowed, click Return.
Administrator user
Use the following administrator user id
and pwd
log in:
id:17373290
pwd:root
log in
New book
Click Add Book on the main interface of the book management, and then enter the book information.
Delete book
Click Delete on the book display page to delete the book. If there are still students borrowing the book, the deletion will fail and the request will be intercepted by the interceptor.
Modify book information
Click Update on the book display page to modify the book information.
Check student borrowing
Enter the student ID to query all books borrowed by the student.
System deployment instructions
To start the mysql database, you need to use administrator rights
Start idea
[External chain image transfer failed, the source station may have an anti-theft chain mechanism, it is recommended to save the image and upload it directly (img-1RVr1FEf-1585133695077) /%E5%90%AF%E5%8A%A8IDEA.png?raw=true)]
Connect to the database: make sure the user and password are filled in correctly
Start TOMCAT: need to pay attention to add dependency package to the project structure, MAVEN will not automatically add.
[External chain image transfer failed, the source site may have an anti-theft chain mechanism, it is recommended to save the image and upload it directly (img-tF9To983-1585133695079) (https://github.com/Gary11111/SE-Peroject1/blob/master/IMG /%E5%90%AF%E5%8A%A8TMOCAT.png?raw=true)]
Code statistics
-------------------------------------------------------------------------------
Language files blank comment code
-------------------------------------------------------------------------------
Java 18 193 46 844
JSP 9 62 44 558
XML 8 34 42 207
Maven 1 3 0 44
-------------------------------------------------------------------------------
SUM: 36 292 132 1653
-------------------------------------------------------------------------------
SUM: 36 292 132 1653