[Java/SSM/LayUI] JavaEE course design (introduction and source code of library management system project based on Layui+SSM)

JavaEE course design (library management system based on Layui+SSM)

Note:

This article is the course design of the JavaEE course. If you need the original file and project code, please contact the author or qq3416252112 in the background. You can also download it from the author's homepage resource, which is only for learning and communication!

1. Project introduction

​ Combining the knowledge learned this semester and the experience accumulated in the past, we have completed a simplified version of the "library management system" through Layui+SSM. The operation interface of this system is simple and beautiful, and it can efficiently, quickly and stably manage the data information of the library. The system mainly includes the following functions: borrowing management, library management, category management, announcement management, administrator management, and statistical analysis (the specific forms are shown in Figure 1-1 and Figure 1-2). The administrator only needs to operate this system, and can easily realize the operations such as inquiry, addition and deletion of book information, and the librarian can complete the basic information management work of the library management conveniently and quickly by using this system.

img

  • (Figure 1-1, system login page)

img

  • (Figure 1-2, screenshot of the system home page)

2. Technology stack

​ Database: MySQL

​ Development tools: IDEA

​ Database connection pool: Druid

​ Web container: Apache Tomcat

​ Project management tool: Maven

​ Front-end framework: LayUI

​ Backend technology: Spring, SpringMVC, MyBatis

3. Project structure

(1) Database

​ The background database contains a total of six data tables, namely admin, book_info, lend_list, notice, reader_info, and type_info. The specific functions are as follows:

1. Administrator table (admin)

​ The main content of this table is the administrator information of the system, including four fields: id, username, password, and adminType, where id is the user id that cannot be repeated, username is the user login name, password is the user login password, and adminType is the administrator type . The value of adminType can only be 1 or 2. 1 indicates that the user is a senior administrator, and 2 indicates that the user is a general administrator. The preset data of the admin data table is shown in Figure 3-1-1.

img

  • (Figure 3-1-1, administrator information)
2. Book type table (type_info)

​ The content of the data table is the type of books, which can be classified. We have preset six types of books, as shown in Figure 3-1-2.

img

  • (Figure 3-1-2, book classification information)
3. Book information table (book_info)

​ This data table mainly stores the basic information of all books in the tube, such as: book name, author, publisher, book id, content introduction, language type, book type, price, publication date, etc. The built-in data is shown in Figure 3-1-3.

img

  • (Figure 3-1-3, Book Information)
4. Reader information table (reader_info)

​ This data table mainly stores the basic information and login information of all readers. It contains 11 fields including id, username, password, realName, sex, birthday, address, tel, email, registerDate, readerNumber, etc., respectively representing the data id and login name , login password, reader name, reader gender, date of birth, address, contact number, email address, registration date and reader number. The preset information is shown in Figure 3-1-4.

img

  • (Figure 3-1-4, reader information)
5. Borrowing information (lend_list)

​ The main content of the data table is the borrowing information of the book. The key fields are bookId, readerId, lendDate, backDate, and backType, which respectively represent the book id, reader id, borrowing time, return time, and return type. The value of backType is optional 1, 2, 3, and null, respectively, and indicates that the current book status is: in borrowing, delayed return, lost book, and damaged book. The preset information is shown in Figure 3-1-5.

img

  • (Figure 3-1-5, Book Borrowing Information)
6. Announcement management (notice)

​ The main content of this data table is the book announcement issued by the administrator, which includes the title, content, author, and release time of the announcement. The preset information is shown in Figure 3-1-6.

img

  • (Figure 3-1-6, announcement information)

(2) Front-end view page (LayUI)

​ The front-end view page is mainly based on the LayUI framework and implemented through SpringMVC. The page structure is shown in Figure 3-2-1.

img

  • (Figure 3-2-1, view page structure)

​ All jsp view pages of the system are located in the "pages" folder under the "webap/WEB-INF" directory, as shown in Figure 3-2-1, there are eight subdirectories and three jsp view pages in the pages directory , the functions of the eight subdirectories are as follows:

  1. ​ admin directory: user information display page (adminIndex.jsp), add user page (adminAdd.jsp), delete and modify user information page (updateAdmin.jsp).
  2. ​ book directory: book information display page (bookIndex.jsp), add book page (bookAdd.jsp), delete and modify book information page (updateBook.jsp).
  3. ​ count directory: Statistical analysis display page (staticIndex.jsp), due to limited time, we only completed the statistical analysis diagram of one book category.
  4. ​ Lend directory: book borrowing information display page (lendListIndex.jsp), book borrowing page (addListIndex.jsp), book return page (excBackBook.jsp), book list page (lookBookList.jsp).
  5. ​ notice directory: administrator notice display page (noticeIndexOfBack.jsp), reader notice display page (noticeIndexOfReader.jsp), add notice page (noticeAdd.jsp), delete and modify notice page (updateNotice.jsp).
  6. ​ pwdUpdate directory: modify password page (updatePwd.jsp).
  7. ​ reader directory: add reader page (readerAdd.jsp), reader display page (readerIndex.jsp), modify or delete reader information page (updateReader.jsp).
  8. ​ type directory: book type display page (readerIndex.jsp), add book type page (typeAdd.jsp), modify and delete book type page (updateType.jsp).
  9. ​ index.jsp file: This file is the page after the user successfully logs in.
  10. ​ login.jsp file: This page is the user login page.
  11. ​ welcome.jsp file: This page is a transition page when loading other pages.

(3) Backend implementation (SSM)

1. Project directory structure, as shown in Figure 3-3-1.

img

  • (Figure 3-3-1, project directory structure)

​ The background project structure is mainly composed of verification code generation tool (codeuitl), front-end controller (controller), dao interface (dao), interceptor (interceptor), entity class (po), business function (service), and packaged development tools (utils) and static resource files (resources) and other 8 parts.

2. Introduction to the function of the development directory
(1) codeuill directory

​ The files in this directory are mainly used for verification code generation, and the specific effect is shown in Figure 3-3-2-1.

img

  • (Figure 3-3-2-1, login verification)
(2) controller directory

​ This directory contains the known front-end controllers in the project, which are used for forwarding control and enhancement between various pages, as shown in Figure 3-3-2-2.

img

  • (Figure 3-3-2-2, controller controller)
(3) dao directory

​ This directory is mainly the mapper interface, and the addition, deletion, modification and query of database tables are all implemented through the interface in this directory, as shown in Figure 3-3-2-3.

img

  • (Figure 3-3-2-3, dao interface file)
(4) interceptor directory (implementation of login interception)

​ The system interceptor is stored in this directory. In this project, I only wrote an interceptor about login. The specific code is as follows:

package com.yx.interceptor;
import org.springframework.web.servlet.HandlerInterceptor;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

public class LoginInterceptor implements HandlerInterceptor  {
    
    

    @Override
    public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception {
    
    
        System.out.println("执行后,返回前执行....");
    }

    @Override
    public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) throws Exception {
    
    
        //在处理过程中进行拦截
    }

    @Override
    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
    
    

        //已经登录了就放行 否则进行拦截
        HttpSession session=request.getSession();
        if(session.getAttribute("user")!=null){
    
    
            return true;//放行
        }else{
    
    
            //没有登录 跳转到登录页面进行登录操作
            response.sendRedirect(request.getContextPath()+"/login");
            return false;
        }
    }
}
(5) po directory

​ This directory mainly contains the entity class information of each data table, as shown in Figure 3-3-2-5.

img

  • (Figure 3-3-2-5)
(6) service directory

​ This directory is mainly for the implementation classes and various business functions for each data table dao query, as shown in Figure 3-3-2-6.

img

  • (Figure 3-3-2-6, service directory)
(7) utils directory

​ There are two files in this directory, Contants.java and DataInfo.java. The Contants.java file stores the constants used in the development process, and the DataInfo tool class is used for data encapsulation.

(8) resources directory

​ Used to store static resource files and mapper.XML files for storing SQL statements, as shown in Figure 3-3-2-8.

img

  • (Figure 3-3-2-8, static resource directory)

(4) Maven dependency information

​ The specific dependency information is in the pom.xml file of the project.

4. Function introduction

(1) User login

​ The system can log in to the library management system as an administrator, or log in to the reader's borrowing management system through the reader.

1. Administrator login

​ As shown in Figure 4-1-1-1, the administrator "He Zhuangzhuang" logs into the library management system, the login password is "123456", and the user type is "Administrator". After entering the verification code, click "Login" to enter the system (Figure 4-1-1-2).

img

  • (Figure 4-1-1-1, login page)

img

  • (Figure 4-1-1-2, the home page of the library management system)
2. Reader login

​ As shown in Figure 4-1-2-1, the reader "zhangsan" logs into the library management system, the login password is "12345", and the user type is "Reader". After entering the verification code, click "Login" to enter the system (Figure 4- 1-2-2).

img

  • (Figure 4-1-2-1, reader login)

img

  • (Figure 4-1-2-2, the home page of the borrowing system)

(2) Function management

​ Mainly introduces the function management module in the library management system logged in by the administrator. The main functions are as follows.

1. Borrowing management

​ Borrowing management mainly includes the functions of borrowing information query, borrowing books, and returning books, as shown in Figure 4-2-1-1 and Figure-2-1-2 below:

img

  • (Figure 4-2-1-1, Borrowing Management Homepage)

img

  • (Picture 4-2-1-2, click the 'Borrowing Book' button to enter the "Book Borrowing Management" page)
2. Book management

​ The book management module includes functions such as book query, adding books, deleting books, and modifying book information, as shown in Figure 4-2-2-1, Figure 4-2-2-2, and Figure 4-2-2-3 Show:

img

  • (Figure 4-2-2-2, Book List)

img

  • (Figure 4-2-2-1, click the "Add" button to enter the "Add Book" page)

img

  • (Figure 4-2-2-3, click the "Modify" button to enter the "Modify Book Information" page)
3. Reader Management

​ The reader management module includes functions such as reader query, adding readers, deleting readers, and modifying reader information, as shown in Figure 4-2-3-1, Figure 4-2-3-2, and Figure-2-3-3 :

img

  • (Figure 4-2-3-1, reader list page)

img

  • (Figure 4-2-3-2, click the "Add" button to enter the "Add Reader" page)

img

  • (Figure 4-2-3-3, click the "Modify" button to enter the "Modify Reader Information" page)
4. Type management

​ The type management module includes functions such as querying book types, adding book types, deleting book types, and editing book types, as shown in Figure 4-2-4-1, Figure 4-2-4-2, and Figure-2-4- 3 shows:

img

  • (Figure 4-2-4-1, book type list page)

img

  • (Figure 4-2-4-2, click the "Add" button, and the "Add Type" page will pop up)

img

  • (Figure 4-2-4-3, click the "Modify" button, and the "Modify Book Type" page will pop up)
5. Announcement management

​ The announcement management module includes functions such as announcement query, adding announcements, deleting announcements, and viewing announcement details, as shown in Figure 4-2-5-1, Figure 4-2-5-2, and Figure 4-2-5-3 Show:

img

  • (Figure 4-2-5-1, list of published announcements)

img

  • (Figure 4-2-5-2, click the "Publish Announcement" button, and the "Publish Announcement" window will pop up)

img

  • (Figure 4-2-5-3, click the "Query Details" button to view the details of the announcement)
6. Administrator management

​ The administrator management module includes functions such as administrator query, adding administrators, deleting administrators, and viewing administrator details, as shown in Figure 4-2-6-1, Figure 4-2-6-2, and Figure 4-2 -6-3 shows:

img

  • (Figure 4-2-6-1, administrator list)

img

  • (Figure 4-2-6-2, click the "Add" button, and the "Add Administrator" window will pop up)

img

  • (Figure 4-2-6-3, click the "Change Password" button, and the "Modify Administrator Information" window will pop up)

(3) Statistical analysis

​Due to limited time, in the statistical analysis module, we only completed the chart of book category statistics, as shown in Figure 4-3:

img

  • (Figure 4-3, Chart Analysis of Book Types)

5. Project Summary

​ This library management system describes the entire construction process of the system step by step from requirements, design, implementation, and testing, based on the SSM knowledge learned this semester and the experience accumulated in the past. Developed with SSM technology, it realizes the separation of business, view and data. Considering that the design of the database not only needs to meet the needs of the software platform, but also needs to be able to be easily maintained and expanded, so as to better improve the access efficiency of the system and the consistency of the data. Compared with the manual book management method, it can better save labor costs and time costs, and can greatly improve work efficiency and improve readers' reading quality.

​Through the development of this graduation project, our technology in JavaEE has been improved to a certain extent, we have also gained a better understanding of cache middleware, and accumulated development experience at the same time. Through practical operation, the theoretical knowledge learned in school is applied to the actual development, which deepens the understanding of theoretical knowledge; and has a deeper understanding of the entire process of a project from demand analysis, design, to programming. I believe that the knowledge learned in course design will play a great role in my future work and help me solve many problems.

Based on the knowledge and experience accumulated in the past, it describes the entire construction process of the system step by step from requirements, design, implementation, and testing. Developed with SSM technology, it realizes the separation of business, view and data. Considering that the design of the database not only needs to meet the needs of the software platform, but also needs to be able to be easily maintained and expanded, so as to better improve the access efficiency of the system and the consistency of the data. Compared with the manual book management method, it can better save labor costs and time costs, and can greatly improve work efficiency and improve readers' reading quality.

​Through the development of this graduation project, our technology in JavaEE has been improved to a certain extent, we have also gained a better understanding of cache middleware, and accumulated development experience at the same time. Through practical operation, the theoretical knowledge learned in school is applied to the actual development, which deepens the understanding of theoretical knowledge; and has a deeper understanding of the entire process of a project from demand analysis, design, to programming. I believe that the knowledge learned in course design will play a great role in my future work and help me solve many problems.

Guess you like

Origin blog.csdn.net/m0_47015897/article/details/130170855