Books Management System

832202106 孙兴 2024-10-26 21:24:54

 

Course for This Assignment2401_MU_SE_EE308
Student IDFZU:8322020106 MU:221244837
Assignment RequirementsDesign a front-end and back-end separated contact
Objectives of This AssignmentExercise independent learning ability to experience the pocess of developing the software and learn the basic knowledge of software development.
Frontend linkinghttps://github.com/sunxing000/softerengineering/tree/idea----webapp.
Backend linkinghttps://github.com/sunxing000/softerengineering/tree/idea----classes,java,resource.

目录

1. Project introduction 

2. PSP table

3.Function display

3.1 Login system

 3.2 Add function

3.3 Delete function

3.4 Changing function

3.5 Look-up function

4.Design and development explained

4.1 Books Management System background 

4.2 Books Management System significance

4.3 Library Management System technology

4.4 Book management system development process

5. code explanation

         5.1 Frontend

         5.2 Backend

6.Learning challenges and reflection summary

         6.1 Challenges

         6.2 Gains



1. Project introduction 

This project is a library management system, you can choose the identity of the administrator or borrow the reader identity, you can add, delete, change and check the books, books management including book name, number, category, publishing house, language, etc., but also includes books borrowing, reader management, type management, etc. A powerful search function makes borrowing books easier.

2. PSP table

ModulesTask DescriptionEstimated TimeActual Time
Demand AnalysisSearch and determine the information and technique that I may need3 hour4 hour
Database DesignEstablish the connect between the database and the server,and eidt the elementary about the database7 hours10 hours
Backend Development Write an interface and develop some service15 hours18 hours
Front-end DevelopmentUsing JS to implemet interactive functions and design some interface.10 hours8 hours
TestTest the stability and feasibility of the project 2 hour1 hours
Total                                                    /37 hours41 hours

3.Function display

Next, I will use animated GIFs to show the functions of adding, deleting, changing, and searching

3.1 Login system

Entering the link, you can enter the account password and verification code according to your identity.

 3.2 Add function

Click the Add button in the upper left corner to add books, readers, etc.

3.3 Delete function

Click the delete button to the right of each row to delete the book or reader information.

3.4 Changing function

Click the Edit button on the right of each line to edit the book or reader's information.

3.5 Look-up function

In the query interface above, enter the name of the library card or book or return type and other keywords to query the book or reader information you want to query.

4.Design and development explained

4.1 Books Management System background 

This project aims to achieve efficient management of book borrowing, registration and other information through the construction of information system, and provide convenient management of reader information. The core functions of the system include books adding, deleting, querying, borrowing and returning records management, as well as readers' basic information management and borrowing situation tracking. This system will help the librarian to complete the daily management work quickly and accurately. At the same time, it is convenient for the administrator to count and analyze the book circulation data, and provide support for the daily management and decision-making of the library.

4.2 Books Management System significance

  • Improve management efficiency

By informatization of the book management process, the time and effort required for manual recording are reduced, and the management efficiency is significantly improved. Administrators can easily borrow and return books, which saves a lot of time for manual data processing.

  • Optimize the user Experience

This system provides convenient book query and borrowing services, so that readers can more easily obtain borrowing information and personal records. Fast query and accurate record of borrowing and returning information will improve the user experience and make the borrowing process smoother.

  • Data accuracy and security

Systematic management can significantly reduce the errors caused by manual operation and improve the accuracy of data. The system can also archive and backup the reader and borrowing information to prevent information loss and ensure the data security of the library.

  • Support data statistics and analysis

The library management system can automatically record and summarize borrowing, registration and other data, which is convenient for administrators to carry out statistical analysis, grasp the circulation of books and reader preferences, and support the library purchase decision and optimal allocation of resources.

  • Promote the transformation of information management

This project promotes the informatization process of library management and provides the basis for subsequent system expansion and function optimization. By gradually introducing information means, it is helpful to realize modern resource management and provide more possibilities for the innovation of library operation mode.

4.3 Library Management System technology

  • Development tool

       IntelliJ IDEA

  • Database

       MYSQL

       Navicat

  • Front-End Technology

      HTML (HyperText Markup Language)

      CSS (Cascading Style Sheets)

      JavaScript

  • Back-end technology

      Spring Boot

4.4 Book management system development process

 

Step1: Clarify the functional requirements, user requirements and performance requirements of the system:

  • Functional requirements

Determine the main functional modules of the system, such as book information management, reader information management, borrowing management, returning books management, data statistics, etc.

  • Non-functional requirements

Such as system performance (response time, concurrency), security (data encryption, user rights control), compatibility (platform, device), etc.

  • User research

Through interviews or questionnaires, understand the specific needs of administrators and readers, and ensure that the system functions and user experience meet the actual use requirements.

 

Step2: Design the system, transform the requirements into technical implementation solutions, which is divided into two parts: architecture design and detailed design.

  • Architecture design

Architecture selection: Decide on a development architecture (e.g. MVC or 3-tier architecture) and stack (e.g. Java Spring, MySQL, frontend Vue.js, etc.).

Database design:Design the database table structure, fields and relationships to ensure that the system can efficiently store, query and update data. For example, book information table, reader information table, borrowing record table, etc.

Module design:According to the requirements, the system is divided into several functional modules (such as book management, reader management, borrowing management, etc.), and the interface and interaction mode between the modules are clear.

  • Detailed Design

Data flow diagram and flow chart: Draw detailed data flow diagram and business flow chart to show the internal data flow and business logic of the system.

Interface design: Define the interface between modules, specify the data type and format to be passed, and provide standards for subsequent development.

UI/UX Design: Design user interface sketches and user interaction flows to ensure that the system interface is simple and easy to use. Including book query, borrowing, return books and other page layout design.

 

Step3: System development, the system functions are gradually realized according to the system design specification. It can be divided into front-end, back-end and database development.

 

Step3.1: Front-end development

  • Interface development

Realize the user interface of the system, and develop the interface of book query, reader information management, borrowing and returning books management.

  • Docking with back-end interface

Call back-end API to realize data query, add, update and other functions to ensure the accuracy of data interaction between front-end and back-end.

 

Step3.2: Backend development

  • Business logic development

Realize the business logic of borrowing and returning books, and ensure that each functional module operates according to the requirements. It includes the logic of checking the borrowing and returning conditions, updating the borrowing status and so on.

  • API interface implementation

It provides data interface for the front end, and realizes functions such as data processing, transaction control and authority control to ensure data consistency and security.
Data processing and optimization: Optimize database access speed, such as caching, query optimization, and so on.

 

Step3.3: Database Development

  • Database table creation

Create the database table structure according to the design document and ensure the correctness of the relationships between the data tables (such as foreign key Settings).

  • Data storage and query optimization

Implement data storage procedures, triggers and indexes to improve database performance and ensure system query and operation efficiency.

In the database, there are six tables, each table has a corresponding module

1). admin 

序号

字段

说明

数据类型

长度

自增

主键

允许空

默认值

1

id

id

int

 

×

×

NULL

2

username

用户名

varchar

20

×

×

NULL

3

password

密码

varchar

20

×

×

NULL

4

adminType

管理员类型

int

 

×

×

NULL

2). book_info 

序号

字段

说明

数据类型

长度

自增

主键

允许空

默认值

1

id

id

int

 

×

×

NULL

2

name

图书名称

varchar

20

×

×

NULL

3

author

作者

varchar

30

×

×

NULL

4

publish

出版社

varchar

30

×

×

NULL

5

isbn

书籍编号

varchar

30

×

×

NULL

6

introduction

简介

varchar

50

×

×

NULL

7

language

语言

varchar

20

×

×

NULL

8

price

价格

double

 

×

×

NULL

9

publish_date

出版时间

date

 

×

×

NULL

10

type_id

书籍类型

int

 

×

×

NULL

11

status

状态:0未借出,1已借出

int

 

×

×

NULL

3). lend_list 

序号

字段

说明

数据类型

长度

自增

主键

允许空

默认值

1

id

id

int

 

×

×

NULL

2

bookId

图书id

int

 

×

×

NULL

3

readerId

读者id

int

 

×

×

NULL

4

lendDate

借书时间

datetime

 

×

×

NULL

5

backDate

还书时间

datetime

 

×

×

NULL

6

backType

还书状态

int

 

×

×

NULL

7

exceptRemarks

备注信息

varchar

255

×

×

NULL

4). notice 

序号

字段

说明

数据类型

长度

自增

主键

允许空

默认值

1

id

id

int

 

×

×

NULL

2

topic

公告标题

varchar

50

×

×

NULL

3

content

公告内容

varchar

255

×

×

NULL

4

author

发布人

varchar

20

×

×

NULL

5

createDate

公告发布时间

datetime

 

×

×

NULL

5). reader_info 

序号

字段

说明

数据类型

长度

自增

主键

允许空

默认值

1

id

id

int

 

×

×

NULL

2

username

用户名

varchar

20

×

×

NULL

3

password

密码

varchar

20

×

×

NULL

4

realName

真实姓名

varchar

20

×

×

NULL

5

sex

性别

varchar

5

×

×

NULL

6

birthday

出生日期

date

 

×

×

NULL

7

address

籍贯

varchar

30

×

×

NULL

8

tel

电话号码

varchar

11

×

×

NULL

9

email

邮箱地址

varchar

15

×

×

NULL

10

registerDate

注册日期

datetime

 

×

×

NULL

11

readerNumber

读者编号

varchar

20

×

×

NULL

6). type_info 

序号

字段

说明

数据类型

长度

自增

主键

允许空

默认值

1

id

id

int

 

×

×

NULL

2

name

图书分类名称

varchar

20

×

×

NULL

3

remarks

备注

char

10

×

×

NULL

5. code explanation

Frontend

  •   1.default theme
/*headerRightBg */
.layui-layout-admin .layui-header {
    /*background-color: #ffffff !important;*/
}

/*headerRightBgThis */
.layui-layout-admin .layui-header .layuimini-header-content > ul > .layui-nav-item.layui-this, .layuimini-tool i:hover {
    background-color: #e4e4e4 !important;
}

/*headerRightColor */
.layui-layout-admin .layui-header .layui-nav .layui-nav-item a {
    color: rgba(107, 107, 107, 0.7);
}

/*headerRightChildColor */
.layui-layout-admin .layui-header .layui-nav .layui-nav-item .layui-nav-child a {
    color: rgba(107, 107, 107, 0.7) !important;
}

/*headerRightColorThis */
.layui-header .layuimini-menu-header-pc.layui-nav .layui-nav-item a:hover, .layui-header .layuimini-header-menu.layuimini-pc-show.layui-nav .layui-this a {
    color: #565656 !important;
}

/*headerRightNavMore */
.layui-header .layui-nav .layui-nav-more {
    border-top-color: rgba(160, 160, 160, 0.7) !important;
}

/*headerRightNavMore */
.layui-header .layui-nav .layui-nav-mored, .layui-header .layui-nav-itemed > a .layui-nav-more {
    border-color: transparent transparent rgba(160, 160, 160, 0.7) !important;
}

/*headerRightNavMoreBg headerRightNavMoreColor */
.layui-header .layui-nav .layui-nav-child dd.layui-this a, .layui-header .layui-nav-child dd.layui-this, .layui-layout-admin .layui-header .layui-nav .layui-nav-item .layui-nav-child .layui-this a {
    background-color: #1E9FFF !important;
    color: #ffffff !important;
}

/*headerRightToolColor */
.layui-layout-admin .layui-header .layuimini-tool i {
    color: #565656;
}

/*logo headerLogoBg */
.layui-layout-admin .layuimini-logo {
    background-color: #192027 !important;
}

/*logo headerLogoColor */
.layui-layout-admin .layuimini-logo h1 {
    color: rgb(191, 187, 187);
}

/*leftMenuNavMore */
.layuimini-menu-left .layui-nav .layui-nav-more, .layuimini-menu-left-zoom.layui-nav .layui-nav-more {
    border-top-color: rgb(191, 187, 187);
}

/*leftMenuNavMore */
.layuimini-menu-left .layui-nav .layui-nav-mored, .layuimini-menu-left .layui-nav-itemed > a .layui-nav-more, .layuimini-menu-left-zoom.layui-nav .layui-nav-mored, .layuimini-menu-left-zoom.layui-nav-itemed > a .layui-nav-more {
    border-color: transparent transparent rgb(191, 187, 187) !important;
}

/*leftMenuBg */
.layui-side.layui-bg-black, .layui-side.layui-bg-black > .layuimini-menu-left > ul, .layuimini-menu-left-zoom > ul {
    background-color: #28333E !important;
}

/*leftMenuBgThis */
.layuimini-menu-left .layui-nav-tree .layui-this, .layuimini-menu-left .layui-nav-tree .layui-this > a, .layuimini-menu-left .layui-nav-tree .layui-nav-child dd.layui-this, .layuimini-menu-left .layui-nav-tree .layui-nav-child dd.layui-this a, .layuimini-menu-left-zoom.layui-nav-tree .layui-this, .layuimini-menu-left-zoom.layui-nav-tree .layui-this > a, .layuimini-menu-left-zoom.layui-nav-tree .layui-nav-child dd.layui-this, .layuimini-menu-left-zoom.layui-nav-tree .layui-nav-child dd.layui-this a {
    background-color: #1E9FFF !important
}

/*leftMenuChildBg */
.layuimini-menu-left .layui-nav-itemed > .layui-nav-child {
    background-color: #0c0f13 !important;
}

/*leftMenuColor */
.layuimini-menu-left .layui-nav .layui-nav-item a, .layuimini-menu-left-zoom.layui-nav .layui-nav-item a {
    color: rgb(191, 187, 187) !important;
}

/*leftMenuColorThis */
.layuimini-menu-left .layui-nav .layui-nav-item a:hover, .layuimini-menu-left .layui-nav .layui-this a, .layuimini-menu-left-zoom.layui-nav .layui-nav-item a:hover, .layuimini-menu-left-zoom.layui-nav .layui-this a {
    color: #ffffff !important;
}

/*tabActiveColor */
.layuimini-tab .layui-tab-title .layui-this .layuimini-tab-active {
    background-color: #1e9fff;
}

 

  1. getBookByName(String bookName) Description: This method retrieves a list of books based on the provided book name. Parameters:

    • bookName (String): The name of the book to search for. Returns:

    • `List<Book>: A list of Book objects matching the specified name. Implementation: Utilizes bookMapper to fetch books from the database that match the given name.

  2. getBookById(Integer bookId) Description: This method retrieves a specific book using its ID. Parameters:

    • bookId (Integer): The ID of the book to retrieve. Returns:

    • Book: A single Book object corresponding to the provided ID. Implementation: Calls bookMapper to fetch the book with the specified ID from the database.

  3. update(Book book) Description: This method updates the details of an existing book in the database. Parameters:

    • book (Book): The Book object containing updated information. Returns:

    • void: No return value. Implementation: Invokes the update method of bookMapper to persist changes to the book's details.

  4. save(Book book) Description: This method saves a new book to the database. Parameters:

    • book (Book): The Book object to be saved. Returns:

    • void: No return value. Implementation: Utilizes bookMapper to insert the new book into the database.

  5. selectAll() Description: This method retrieves all books from the database. Parameters:

    • None Returns:

    • List<Book>: A list of all Book objects in the database. Implementation: Calls the selectAll method of bookMapper to fetch all books.

  6. buy(Integer bookId, Integer quantity) Description: This method handles the purchasing logic for a book, updating inventory or sales information. Parameters:

    • bookId (Integer): The ID of the book to purchase.

    • quantity (Integer): The quantity of the book to buy. Returns:

    • void: No return value. Implementation: Uses bookMapper to manage the purchase process based on the provided book ID and quantity.

  • 2.If landing on a non-existent page 
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>404</title>
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta http-equiv="Access-Control-Allow-Origin" content="*">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">
    <link rel="stylesheet" href="../lib/layui-v2.5.5/css/layui.css" media="all">
    <style>
        .error .clip .shadow {height:180px;}
        .error .clip:nth-of-type(2) .shadow {width:130px;}
        .error .clip:nth-of-type(1) .shadow,.error .clip:nth-of-type(3) .shadow {width:250px;}
        .error .digit {width:150px;height:150px;line-height:150px;font-size:120px;font-weight:bold;}
        .error h2 {font-size:32px;}
        .error .msg {top:-190px;left:30%;width:80px;height:80px;line-height:80px;font-size:32px;}
        .error span.triangle {top:70%;right:0%;border-left:20px solid #535353;border-top:15px solid transparent;border-bottom:15px solid transparent;}
        .error .container-error-404 {top: 50%;margin-top: 250px;position:relative;height:250px;padding-top:40px;}
        .error .container-error-404 .clip {display:inline-block;transform:skew(-45deg);}
        .error .clip .shadow {overflow:hidden;}
        .error .clip:nth-of-type(2) .shadow {overflow:hidden;position:relative;box-shadow:inset 20px 0px 20px -15px rgba(150,150,150,0.8),20px 0px 20px -15px rgba(150,150,150,0.8);}
        .error .clip:nth-of-type(3) .shadow:after,.error .clip:nth-of-type(1) .shadow:after {content:"";position:absolute;right:-8px;bottom:0px;z-index:9999;height:100%;width:10px;background:linear-gradient(90deg,transparent,rgba(173,173,173,0.8),transparent);border-radius:50%;}
        .error .clip:nth-of-type(3) .shadow:after {left:-8px;}
        .error .digit {position:relative;top:8%;color:white;background:#1E9FFF;border-radius:50%;display:inline-block;transform:skew(45deg);}
        .error .clip:nth-of-type(2) .digit {left:-10%;}
        .error .clip:nth-of-type(1) .digit {right:-20%;}
        .error .clip:nth-of-type(3) .digit {left:-20%;}
        .error h2 {font-size:24px;color:#A2A2A2;font-weight:bold;padding-bottom:20px;}
        .error .tohome {font-size:16px;color:#07B3F9;}
        .error .msg {position:relative;z-index:9999;display:block;background:#535353;color:#A2A2A2;border-radius:50%;font-style:italic;}
        .error .triangle {position:absolute;z-index:999;transform:rotate(45deg);content:"";width:0;height:0;}
        @media(max-width:767px) {.error .clip .shadow {height:100px;}
            .error .clip:nth-of-type(2) .shadow {width:80px;}
            .error .clip:nth-of-type(1) .shadow,.error .clip:nth-of-type(3) .shadow {width:100px;}
            .error .digit {width:80px;height:80px;line-height:80px;font-size:52px;}
            .error h2 {font-size:18px;}
            .error .msg {top:-110px;left:15%;width:40px;height:40px;line-height:40px;font-size:18px;}
            .error span.triangle {top:70%;right:-3%;border-left:10px solid #535353;border-top:8px solid transparent;border-bottom:8px solid transparent;}
            .error .container-error-404 {height:150px;}
        }
    </style>
</head>
<body>
<div class="error">
    <div class="container-floud">
        <div style="text-align: center">
            <div class="container-error-404">
                <div class="clip">
                    <div class="shadow">
                        <span class="digit thirdDigit"></span>
                    </div>
                </div>
                <div class="clip">
                    <div class="shadow">
                        <span class="digit secondDigit"></span>
                    </div>
                </div>
                <div class="clip">
                    <div class="shadow">
                        <span class="digit firstDigit"></span>
                    </div>
                </div>
                <div class="msg">OH!
                    <span class="triangle"></span>
                </div>
            </div>
            <h2 class="h1">很抱歉,你访问的页面找不到了</h2>
        </div>
    </div>
</div>
<script src="../lib/layui-v2.5.5/layui.js" charset="utf-8"></script>
<script>
    function randomNum() {
        return Math.floor(Math.random() * 9) + 1;
    }

    var loop1, loop2, loop3, time = 30, i = 0, number;
    loop3 = setInterval(function () {
        if (i > 40) {
            clearInterval(loop3);
            document.querySelector('.thirdDigit').textContent = 4;
        } else {
            document.querySelector('.thirdDigit').textContent = randomNum();
            i++;
        }
    }, time);
    loop2 = setInterval(function () {
        if (i > 80) {
            clearInterval(loop2);
            document.querySelector('.secondDigit').textContent = 0;
        } else {
            document.querySelector('.secondDigit').textContent = randomNum();
            i++;
        }
    }, time);
    loop1 = setInterval(function () {
        if (i > 100) {
            clearInterval(loop1);
            document.querySelector('.firstDigit').textContent = 4;
        } else {
            document.querySelector('.firstDigit').textContent = randomNum();
            i++;
        }
    }, time);
</script>
</body>
</html>

1.Meta Tags and External CSS:

  • This file contains meta tags for character set, viewport settings, and cross-browser compatibility.
  • LayUI library CSS is linked externally from ../lib/layui-v2.5.5/css/layui.css.

2.CSS Styling:

  • Layout Styling: The page layout centers the error message and creates a 404 display with large circular "digits" representing the "404" code.
  • Error Message Design: It styles the digit elements to appear as bold circles with shadows and adds a bouncing "OH!" message to indicate an error.
  • Responsive Design: The styles are adjusted for smaller screens, reducing the digit sizes and reorganizing layout properties to maintain a similar look on mobile devices.

3.HTML Structure:

  • Container and Clip Elements: div elements with classes clip, shadow, and digit are arranged to display each digit of "404". Each digit is animated using JavaScript.
  • Error Message Text: A message "Sorry, the page you are looking for could not be found" is shown below the digits.

4.JavaScript Logic:

  • Random Number Function: randomNum() generates random numbers between 1 and 9, simulating the animation effect of rolling numbers.
  • Intervals for Animation: Three setInterval loops (loop1, loop2, loop3) generate and display random numbers in each digit until they gradually settle into "4", "0", and "4" over a set interval.
  • Clearing Intervals: Each interval stops once the desired number is reached (4, 0, 4), producing the "404" animation effect.

 

Backend

  •  1. Administrator Identity Controller
package com.yx.controller;

import com.github.pagehelper.PageInfo;
import com.yx.po.Admin;
import com.yx.service.AdminService;
import com.yx.utils.DataInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.Arrays;
import java.util.List;

@Controller
public class AdminController {

    @Autowired
    private AdminService adminService;

    @GetMapping("/adminIndex")
    public String adminIndex(){
        return "admin/adminIndex";
    }

    @RequestMapping("/adminAll")
    @ResponseBody
    public DataInfo queryAdminAll(Admin admin, @RequestParam(defaultValue = "1") Integer pageNum, @RequestParam(defaultValue = "15") Integer limit){
        PageInfo<Admin> pageInfo = adminService.queryAdminAll(admin,pageNum,limit);
        return DataInfo.ok("成功",pageInfo.getTotal(),pageInfo.getList());
    }

    /**
     * 添加页面的跳转
     * @return
     */
    @GetMapping("/adminAdd")
    public String adminAdd(){
        return "admin/adminAdd";
    }

    /**
     * 添加提交
     * @param admin
     * @return
     */
    @RequestMapping("/addAdminSubmit")
    @ResponseBody
    public DataInfo addBookSubmit(Admin admin){
        adminService.addAdminSubmit(admin);
        return DataInfo.ok();
    }

    /**
     * 根据id查询
     */
    @GetMapping("/queryAdminById")
    public String queryAdminById(Integer id, Model model){
        model.addAttribute("id",id);
        return "admin/updateAdmin";
    }

    /**
     * 修改提交
     */
    @RequestMapping("/updatePwdSubmit")
    @ResponseBody
    public DataInfo updatePwdSubmit(Integer id,String oldPwd,String newPwd){
        Admin admin = adminService.queryAdminById(id);//根据id查询对象
        if (!oldPwd.equals(admin.getPassword())){
            return DataInfo.fail("输入的旧密码错误");
        }else{
            admin.setPassword(newPwd);
            adminService.updateAdminSubmit(admin);//数据库修改
            return DataInfo.ok();
        }
    }

    /**
     * 删除
     */
    @RequestMapping("/deleteAdminByIds")
    @ResponseBody
    public DataInfo deleteAdminByIds(String ids){
        List<String> list = Arrays.asList(ids.split(","));
        adminService.deleteAdminByIds(list);
        return DataInfo.ok();
    }

}

1.queryAdminAll(Admin admin, Integer pageNum, Integer limit):

This method retrieves a paginated list of all Admin objects that match the criteria specified in the admin parameter. It uses the adminService to return a PageInfo<Admin> object containing total entries and list of admins for the current page.

2.addAdminSubmit(Admin admin):

This method receives an Admin object as a parameter and saves it as a new entry in the database by calling adminService.addAdminSubmit(admin). It returns a success response on successful insertion.

3.queryAdminById(Integer id, Model model):

This method takes an Integer parameter id to locate a specific admin by their unique identifier. It adds the id to the model as an attribute and forwards to the "updateAdmin" view for display and further modifications.

4.updatePwdSubmit(Integer id, String oldPwd, String newPwd):

This method receives id, oldPwd, and newPwd as parameters. It retrieves the Admin object by id, validates the oldPwd, and if correct, updates the admin's password to newPwd by calling adminService.updateAdminSubmit(admin). It returns a success response if the password is updated, or an error if the oldPwd is incorrect.

5.deleteAdminByIds(String ids):

This method takes a String of comma-separated ids, splits it into a List<String>, and then calls adminService.deleteAdminByIds(list) to delete multiple admin entries from the database. It returns a success response if the deletion is successful.

  • Library Management controller
package com.yx.controller;

import com.github.pagehelper.PageInfo;
import com.yx.po.BookInfo;
import com.yx.po.TypeInfo;
import com.yx.service.BookInfoService;
import com.yx.service.TypeInfoService;
import com.yx.utils.DataInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;

import java.util.Arrays;
import java.util.List;

@Controller
public class BookInfoController {

    @Autowired
    private BookInfoService bookInfoService;

    @Autowired
    private TypeInfoService typeInfoService;

    /**
     * 图书管理首页
     * @return
     */
    @GetMapping("/bookIndex")
    public String bookIndex(){
        return "book/bookIndex";
    }

    /**
     * 获取book信息,封装成json
     * @param bookInfo
     * @param pageNum
     * @param limit
     * @return
     */
    @RequestMapping("/bookAll")
    @ResponseBody       //@ResponseBody将java对象转为json格式的数据,表示该方法的返回结果直接写入 HTTP response body 中,一般在异步ajax获取数据时使用
    public DataInfo bookAll(BookInfo bookInfo, @RequestParam(defaultValue = "1") Integer pageNum, @RequestParam(defaultValue = "15") Integer limit){
        PageInfo<BookInfo> pageInfo = bookInfoService.queryBookInfoAll(bookInfo,pageNum,limit);
        return DataInfo.ok("成功",pageInfo.getTotal(),pageInfo.getList());//总条数getTotal,数据封装成list,以便加载分页显示,由于加了ResponseBody,就会返回一个字符串
    }

    /**
     * 添加页面的跳转
     */
    @GetMapping("/bookAdd")
    public String bookAdd(){
        return "book/bookAdd";
    }

    /**
     * 类型添加提交
     */
    @RequestMapping("/addBookSubmit")
    @ResponseBody
    public DataInfo addBookSubmit(BookInfo info){
        bookInfoService.addBookSubmit(info);
        return DataInfo.ok();
    }

    /**
     * 类型根据id查询(修改)
     */
    @GetMapping("/queryBookInfoById")
    public String queryTypeInfoById(Integer id, Model model){
        BookInfo bookInfo= bookInfoService.queryBookInfoById(id);
        model.addAttribute("info",bookInfo);
        return "book/updateBook";
    }

    /**
     * 修改提交功能
     */

    @RequestMapping("/updateBookSubmit")
    @ResponseBody
    public DataInfo updateBookSubmit(@RequestBody BookInfo info){
        bookInfoService.updateBookSubmit(info);
        return DataInfo.ok();
    }
    /**
     * 类型删除
     */

    @RequestMapping("/deleteBook")
    @ResponseBody
    public DataInfo deleteBook(String ids){
        List<String> list= Arrays.asList(ids.split(","));
        bookInfoService.deleteBookByIds(list);
        return DataInfo.ok();
    }

    @RequestMapping("/findAllList")
    @ResponseBody
    public List<TypeInfo> findAll(){
        PageInfo<TypeInfo> pageInfo = typeInfoService.queryTypeInfoAll(null,1,100);
        List<TypeInfo> lists = pageInfo.getList();
        return lists;
    }
}

1.bookIndex()

This method returns the view for the book management homepage, book/bookIndex.

2.bookAll(BookInfo bookInfo, Integer pageNum, Integer limit)

This method retrieves a paginated list of BookInforecords based on the criteria in the bookInfo parameter. It uses bookInfoService.queryBookInfoAll(bookInfo, pageNum, limit to return a PageInfo<BookInfo> object with the total number of entries and a list of books for the current page. The response is converted to JSON using @ResponseBody.

3.bookAdd()

This method returns the view for adding a new book, book/bookAdd.

4.addBookSubmit(BookInfo info)

This method takes a BookInfo object as a parameter and submits it to the database using bookInfoService.addBookSubmit(info). It returns a success message on successful insertion.

5.queryTypeInfoById(Integer id, Model model)

This method retrieves a BookInfo record based on the given id. It uses bookInfoService.queryBookInfoById(id) ,then adds the book data to the model as an attribute info and forwards it to the book/updateBook view.

6.updateBookSubmit(BookInfo info)

This method takes a BookInfo object as a parameter in the request body and submits an update using bookInfoService.updateBookSubmit(info). It returns a success message upon successful update.

7.deleteBook(String ids)

This method takes a comma-separated String of book IDs, converts them into a List<String>, and then deletes the specified records by calling bookInfoService.deleteBookByIds(list) It returns a success message if the deletion is completed.

8.findAll()

This method returns a list of all TypeInfo records for book types. It uses typeInfoService.queryTypeInfoAll(null, 1, 100) to get a PageInfo<TypeInfo> object, then extracts and returns the list of types. This response is returned as JSON.

 

6.Learning challenges and reflection summary

In the process of develop the books management system, challenges and gains coexist:

6.1 Challenges

  • Requirement analysis and function design

In the early stages of development, a deep understanding of the library's business processes, lending rules, and the needs of different users, such as administrators and patrons, was critical but challenging. How to accurately capture and transform requirements, and design system functions that meet users' expectations, will directly affect the practicability of the system.

  • Database design

The data structure of the library management system is complex, involving books information, borrowing records, reader information and other modules. To design a database architecture that can not only meet the query efficiency, but also have scalability, it is necessary to consider the setting of relational tables, index optimization and other details.

  • Data consistency and transaction Processing

The challenge is to ensure data consistency when multiple users are working at the same time. For example, readers may encounter concurrency problems when they are borrowing and returning books, which requires the system to have good transaction processing capabilities to prevent the error or loss of borrowed and returned data.

  • System security

The library management system involves readers' personal information and borrowing records, so it is very important to ensure the privacy and security of data. This involves not only login and authority management, but also security measures such as data encryption and SQL injection prevention to avoid user data leakage.

  • User Experience Design

Designing an intuitive and easy-to-use user interface to enable administrators and readers to quickly get up to speed and complete the operation of the system requires a balance of simplicity and functionality. Especially in the core modules of book search, borrowing and returning process, information query, it is necessary to not only ensure that the operation process is simplified, but also take into account the complete display of information.

6.2 Gains

  • Technical capability enhancement

       Through this project, I can deeply learn and practice database design, data consistency control and other technologies, improve my technical ability in system architecture, database optimization and other aspects, and accumulate practical development experience.

  • Understanding and translating user requirements

       Through communicating with the demand side and constantly adjusting the design, we have accumulated experience in understanding user needs and making reasonable transformation. This will help to carry out requirement analysis and system design more accurately in the future development.

  • Problem solving and collaboration skills

       In dealing with system debugging, performance optimization, data security and other issues, can exercise their ability to solve complex problems. In addition, communication and teamwork in the project will also help myself to better cooperate with others and accumulate experience in project management and cross-functional communication.

  • User Experience Design thinking

       By designing a friendly and intuitive user interface, you can enhance your understanding of user experience design and help to develop applications that better meet the needs of users. This kind of design thinking also has a positive impact on future project design.

  • Systematic thinking

       Through the comprehensive consideration of the system's function, performance, security and other aspects of the needs, exercise the ability of systematic thinking. This ability can help you better balance various modules and requirements in complex projects, and improve the integrity and reliability of system design.

In summary, through the process of the books management system, I learn how to develop a software project overally and I have new understanding for full-stack development.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

|   librarySystem -fontend

|-----webapp

|----------api

|----------css

|----------images

|----------js

|----------page

|----------web-inf

 

|   librarySystem -backend

|-----java

|---------com.yx  #Captcha Generation and implementation

|---------controller  #Take arguments and return a path or database table

|---------dao  #Database persistence interface

|---------interceptor #Login blockers

|---------po #entity class

|---------service #handling method

|---------util #utility class

|----resources #Data configuration file

 

...全文
317 回复 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复
'We have always recommended these books to our customers and even our own engineers for developing a better understanding of technologies and specifications. We find the latest PCI Express book from MindShare to have the same content and high quality as all the others.' --Nader Saleh, CEO/President, Catalyst Enterprises, Inc. PCI Express is the third-generation Peripheral Component Inter-connect technology for a wide range of systems and peripheral devices. Incorporating recent advances in high-speed, point-to-point interconnects, PCI Express provides significantly higher performance, reliability, and enhanced capabilities--at a lower cost--than the previous PCI and PCI-X standards. Therefore, anyone working on next-generation PC systems, BIOS and device driver development, and peripheral device design will need to have a thorough understanding of PCI Express. PCI Express System Architecture provides an in-depth description and comprehensive reference to the PCI Express standard. The book contains information needed for design, verification, and test, as well as background information essential for writing low-level BIOS and device drivers.In addition, it offers valuable insight into the technology's evolution and cutting-edge features. Following an overview of the PCI Express architecture, the book moves on to cover transaction protocols, the physical/electrical layer, power management, configuration, and more. Specific topics covered include: *Split transaction protocol *Packet format and definition, including use of each field *ACK/NAK protocol *Traffic Class and Virtual Channel applications and use *Flow control initialization and operation *Error checking mechanisms and reporting options *Switch design issues *Advanced Power Management mechanisms and use *Active State Link power management *Hot Plug design and operation *Message transactions *Physical layer functions *Electrical signaling characteristics and issues *PCI Express enumeration procedures *Configura

170

社区成员

发帖
与我相关
我的任务
社区描述
2401_MU_SE_FZU
软件工程 高校
社区管理员
  • FZU_SE_TeacherL
  • 助教-吴可仪
  • 助教-孔志豪
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧