JavaWeb - Design and implementation of book digital management system based on Spring Boot

Course design summary

1    Overview

1.1  Item opening background

With the rapid development of information technology, digital management has become an important means for improving efficiency and management levels in all walks of life. In the field of library management, digital management systems can effectively improve management efficiency and provide a better user experience. This project aims to develop a book digital management system based on Spring Boot to provide administrators and readers with convenient operation and management functions.

  • Automated management requirements: Traditional library management often involves a large number of manual operations, including manual recording of borrowing and returning information, book classification, sorting, and querying. By developing a digital management system, automated library management can be achieved, reducing labor costs and improving work efficiency.
  • Improve user experience: For libraries or book management institutions, providing a convenient and easy-to-use system can improve user experience and satisfaction. The digital management system can provide functions such as online book inquiry, reservation and borrowing, and self-service borrowing and return, making it convenient for users to quickly obtain the books they need and reducing cumbersome procedures.
  • Data statistics and analysis: The digital management system can collect and store a large amount of book-related data, including loan and return records, reader preferences, library resource utilization, etc. Through statistics and analysis of these data, library managers can be provided with decision-making support, such as optimizing book procurement, adjusting lending rules, recommending related books, etc.
  • Security and protection: Digital management systems can enhance the security management of books and book lending information. Through permission control and identity verification, it is ensured that only authorized personnel can perform borrowing operations, and the privacy of readers and the security of borrowing records are protected.

Through this book digital management system based onSpring Boot, administrators and readers can complete relevant operations and management processes online, improving management efficiency, providing a better user experience. At the same time, the system also has the characteristics of high security, easy expansion and maintenance, etc., providing a new solution for library management.

1.2  opening tool

Main item selectionWindows 10JapaneseIntelliJ IDEAProgress System opening.

1.3  Technology adopted

Main technical features of this itemJava, MySQL, Maven, SpringBoot, Mybatis-Plus, MySQL, Vue3,ElementPlus etc.

l Java: Java is a widely used Programming language, it is suitable for various fields including desktop applications, mobile applications, web applications, etc.

l MySQL: MySQL is a popular An open source relational database management system that uses theSQL language as the query language. It is widely used in various applications, such asJava,Python, etc.

l Maven: Maven is a JavaTools for projects that help build, package and deployJava application, it can also manage project dependencies.

l SpringBoot: SpringBoot is a fast A tool for building Java applications based on the Spring framework that automatically Configuration and rapid development interfaces simplifyJavadevelopment.

l Mybatis-Plus: Mybatis-PlusYes A plugin that enhancesMybatis and provides a simplerAPI and More powerful functions, such as full table operations, paging queries, etc., can be more conveniently usedMybatis for database operations.

l Vue3: Vue3 is The latest version of the Vue.js framework, which provides a powerfulAPI for Build reusable components and use virtualDOM for fast, efficient rendering.

l ElementPlus: ElementPlusis An upgraded version of Element UI, which provides more themes and components to quickly build beautifulWebApplication interface.

1.4 Project members

Item and staff list 1‑1 Item and staff list 1‑1< a i=4>Indication.

Table 1‑1 Item member

Name

Position

Scope of responsibility

project manager

Responsible for designing system architecture and integrating data

systems analyst

Responsible for analyzing the feasibility of the system and writing implementation and testing content

designer

Responsible for the design of front-end pages, and writing the content of interface design and database design

Front-end development

Responsible for front-end development and writing overviews and development logs

backend development

Responsible for back-end development and writing interface design

Test Engineer

Responsible for testing the system and writing experimental summaries

Operation and Maintenance Engineer

Responsible for operating and maintaining the system and writing system analysis content

2    Genesis analysis

2.1  Demand analysis

The demand analysis of the digital library management system based onSpring Boot framework includes account management, book management, borrowing relationship management and console statistical information Display and other functional modules. The system needs to provide a general user interface and an administrator interface. Ordinary users and administrators can borrow books, and administrators can manage user accounts. In addition, the system should have statistical functions that can display statistical information such as the number of website visits, the number of users, the number of borrowed books, and the total number of books in real time. Through the technical implementation of the SSM framework, the system can realize user registration, login, book entry, borrowing operations and management functions to meet users' digital book management needs.

2.1.1       Narimoto Commentary

Cost considerations are an important factor in the requirements analysis for developing a digital library management system. Team size is seven people, time limit is one week, and funding is not included. Cost considerations include labor costs, development tools and environment costs, project management costs, hardware and infrastructure costs, and training and support costs. When evaluating costs, you need to comprehensively consider the team's work hours, skill levels, development tools, and infrastructure needs to ensure that core functions can be implemented within a given time, and make trade-offs and decisions based on actual conditions.

2.1.2       Technology Consideration

In terms of technical considerations, the front-end uses theVue framework and the back-end usesSpring Boot. Technical considerations include front-end development, back-end development, database selection, data interaction and API design, and security considerations. By rationally utilizing these technologies, user interface interaction and data display can be realized, business logic and data access can be realized, and the security and validity of data can be ensured to meet the functional, performance and security requirements of the system. MySQLFramework, database selection

2.1.3       City Consideration

Market considerations are crucial in demand analysis, including clarifying target user groups, competitive analysis, understanding market needs and trends, designing appropriate business models, and paying attention to user feedback and continuous improvement. Through these market considerations, the system can meet the needs of target users, remain competitive with competitors, and be commercially feasible and market adaptable to achieve successful and sustainable development of the system.

2.1.4       Useful consideration

In user consideration, it is necessary to deeply understand the characteristics and needs of target users, design user-friendly interfaces and good user experiences, encourage user participation and feedback, provide appropriate training and support, and ensure user privacy and data security. Through these user considerations, the system can meet user expectations and needs, provide a quality user experience, and build user trust and satisfaction to achieve system success and long-term user use.

2.2  Feasibility analysis

2.2.1      

The feasibility analysis focuses on development costs and maintenance costs. Based on the condition that the team size is seven people and the time limit is one week, the labor cost needs to be evaluated to ensure that the core function development is completed within the limited time. Based on the use of open source frameworks such as Spring Boot, it can reduce development costs and reduce subsequent maintenance and upgrade costs. Further economic feasibility analysis needs to comprehensively consider the system's business model, charging method and potential revenue to ensure that the system can obtain sufficient returns and profitability.

2.2.2       Technology availability

The front-end uses theVue framework, and the back-end usesSpring BootFramework, database selectionMySQL, these technologies are mature and widely used technology stacks, with stability and reliability. The development team is familiar with these technologies and has the relevant experience and skills to effectively develop and maintain the system. Relevant development tools, integrated environments and database management tools are also easy to obtain and configure to support system development and deployment.

2.2.3       Operationability

The operational feasibility of the system refers to the convenience and operability of the system for users. By using theVue framework and user-friendly interface design, an intuitive and easy-to-use user interface can be provided, allowing users to easily browse books, borrow and manage accounts wait. Reasonable interface interaction and functional design, as well as providing appropriate user training and support, can help users get started quickly and use the system efficiently.

2.3  Ability analysis

Function analysis includes: account management, book management and borrowing management, in addition to the display function of viewing the number of users, the number of borrowings, and the number of visits. Account management is divided into ordinary user account management and administrator account management; the administrator account can manage ordinary users. Book management includes adding books, deleting books, querying books and querying book pages. Inquiries also include individual queries and batch queries. Borrowing management includes book borrowing by ordinary users and book borrowing by administrators. After users borrow books, they can return or renew them, and administrators can save, edit, and adjust time.

3    System configuration

3.1  Summary of abilities

This system is divided into administrator and reader modules.

Administrator module: registration, login, book management, reader management, borrowing management, borrowing status, modify personal information, modify password

Reader module: register, log in, check book information, borrow and return books, view personal borrowing records, modify personal information, modify password

System structure structure 3‑1shown.

3‑1 System summary

3.2  Interface design

3.2.1 Registration page

The registration page includes username, password, confirm password, administrator/reader options, verification code and registration button. After the user completes these steps, he or she can successfully register, and the system will also save the user information to facilitate subsequent operations. The specific page is as shown.

3‑2 Reviewer's Notes Page

When selecting the administrator option, an additional administrator registration code will appear for verification again to ensure security.

3‑3 Management staff note page

3.2.2       Register page

Directly enter the account password and verification code. If the user is not found in the data table, register for this user; if the user is found, determine whether the password is correct. If it is correct, you can enter the user's personal page. The login page is shown in Figure 3‑4.

3‑4 Registration page

3.2.3       User Display Board Page

The user display page includes the number of borrowed items, the total number of visits, the number of books, the number of users and the display of statistical charts, making it more intuitive for users to see the situation of book management. The user display page is shown in Figure 3‑5.

3‑5 Use display page

3.2.4       User personal information

(1)Repair personal information

To modify personal information, you can change the username, name, phone number, gender, address and finally save it. The page for modifying personal information is shown in Figure 3‑6.

Picture 3‑6 Repair personal information

2)Repair secret

Users can modify the password if they need to ensure the security of the password, and finally submit the new password. The password modification page is shown in Figure 3‑7.

3‑7 Repair secret page

3.2.5       User book query

Users can query books by using the book number, book name and author. You can borrow up to 5 books at a time. The user book query page is shown in Figure 3‑8.

3‑8 用户图书查询

1)图书编名查询页面 forth图 3‑9Indication.

 

Picture 3‑9 Book number query

2)Author 查询如图 3‑10Indication.

3‑10 Author 查询

3.2.6       Airport rental information

Users can check whether books have been returned, and can use the book number, book name and author to check the return status. The user borrowing information page is shown in Figure 3‑11.

3‑11 Airport rental information image

(1) book number query return status page is as shown in the figure 3‑12 is shown.

Picture 3‑12 Book number query return status diagram

3.2.7       Airport rental information

Users can check the status of their borrowed books, and when the return date arrives, they can consider whether to renew the loan. User borrowing information is shown in Figure 3‑13.

3‑13 Airport rental information

3.2.8       Administrator Display Board

The administrator display page includes the number of borrowed items, the total number of visits, the number of books, the number of users and the display of statistical charts, making it more intuitive for users to see the situation of library management. The administrator display board page is shown in Figure 3-14

Picture 3‑14 Management staff display board

3.2.9       Administrator personal information

(1)Repair personal information

The administrator can modify personal information, change the username, name, phone number, gender, address and finally save it. The page for modifying personal information is shown in Figure 3‑15.

Picture 3‑15 Management Personnel Information Picture

2)Repair secret

The administrator needs to ensure the security of the password to modify the password, and finally submit the new password. The password modification page is shown in Figure 3‑16.

3‑16 Repair secret

3.2.10    

The administrator can view the reader's information, modify the reader's information, or delete the reader's information. The reader management page is shown in Figure 3‑17.

Picture 3‑17 Participant management page

3.2.11     Book management

The administrator can view the information of the book, modify the information of the book, or delete the information of the book. The book management page is shown in Figure 3‑18.

​​​​​​​

3‑18 Book management

3.2.12     Rental management

The administrator can check the borrowing information, and can use the book number, book name, and reader number to check. The borrowing management page is shown in Figure 3‑19

3‑19 Rental management

The book number query is shown in Figure 3‑20.

Picture 3‑20 Book number query

Reader number query is shown in Figure 3‑21.

3‑21 读者编名查询图

3.2.13     Rental status

The administrator can check which reader has borrowed the book, which book has been borrowed, can modify the borrowing information, and can also delete the borrowing information. The borrowing status page is shown in Figure 3‑22.

3‑22 Rental situation

3.3  Entrance design

3.3.1       BookController

UsingSpring Boot frameworkRESTful interface controller Class for handling book-related operations. The following BookController functional explanation of each method, such as table 3‑1 is shown.

Table 3‑1BookControllermethod

method

effect

Result<?> save(@RequestBody Book Book)

Save aBook object to the database and return the saved result.

Result<?> update(@RequestBody Book Book)

Update aBook object to the database and return the updated results.

Result<?> deleteBatch(@RequestBody List<Integer> ids)

Delete aBook object based onid and return The result after deletion.

Result<?> delete(@PathVariable Long id)

Delete aBook object based onid and return The result after deletion.

3.3.2       BookWithUserController

UsingSpring Boot frameworkRESTful interface controller Class for handling book and user related operations. The following is a functional explanation of each method of BookWithUserController, as shown in Table 3 ‑2 is shown.

3‑2 BookWithUserController的方法

method

effect

Result<?> insertNew(@RequestBody BookWithUser BookWithUser)

Add a newBookWithUser object to the database and return the newly added result.

Result<?> update(@RequestBody BookWithUser BookWithUser)

Update aBookWithUser object to the database and return the updated results.

Result<?> deleteRecord(@RequestBody BookWithUser BookWithUser)

Delete aBookWithUser object to the database and return the deleted result.

3.3.3       DashboardController

UsingSpring Boot frameworkRESTful interface controller Class for handling dashboard related operations. The dashboard page includes the number of borrowed items, the total number of visits, the number of books, the number of users, and the display of statistical charts, making it more intuitive for users to see the situation of book management.

The main function of the DashboardController class is to handle the GET request of the dashboard page and call other Mapper class method to obtain relevant statistical information and store this information in the form of key-value pairs in Map object, and finally returned to the caller to display the dashboard page.

3.3.4       LendRecordController

UsingSpring Boot frameworkRESTful interface controller Class for handling operations related to borrowing records. The following is a functional explanation of each method of LendRecordController, such as table 3 ‑3 is shown.

3‑3 LendRecordController的方法

method

effect

Result<?> deleteRecord(@RequestBody LendRecord LendRecord)

Perform deletion based on a singleLendRecord object and return the deleted result.

Result<?> deleteRecords(@RequestBody List<LendRecord> LendRecords)

Perform batch deletion operations based on multipleLendRecord objects and return the deleted results.

Result<?> save(@RequestBody LendRecord LendRecord)

Save a singleLendRecord object to the database and return the saved result.

3.3.5       UserController

UsingSpring Boot frameworkRESTful interface controller Class for handling user-related operations. The following is a functional explanation of each method of UserController, such as table 3 ‑4 is shown.

3‑4 UserController的方法

method

effect

Result<?> register(@RequestBody User user)

Register a new user to the database and return the registration results.

Result<?> login(@RequestBody User user)

Verify user login and return login results.

Result<?> save(@RequestBody User user)

Save user information to the database and return the saved results.

Result<?> password(@RequestBody User user)

Modify the user password and return the modified result.

Result<?> deleteBatch(@RequestBody List<Integer> ids)

Delete users in batches and return the deleted results.

3.4  Database Design

Sharing the number of books in this series4Dividing the numbers and sharingbook , bookwithuser, lend_recordsum usertable, table design, assembler 3‑23arrival< a i=13> 3‑26shown.

3‑23 bookTable design

3‑24 bookwithuserTable design

Figure 3‑25 lend_recordTable design

3‑26 userTable design

4   

4.1  Key technology implementation (how key issues or difficulties are achieved)

4.1.1       BookController

This module is used to save book entities and update books through bookMapper id and through Batch id< /span>, search pages. bookMapper idBatch deletion, delete books by

package com.example.demo.controller;

@RestController
@RequestMapping("/book")
public class BookController {
    @Resource
    BookMapper BookMapper;

    @PostMapping
    public Result<?> save(@RequestBody Book Book) {
        BookMapper.insert(Book);
        return Result.success();
    }

    @PutMapping
    public Result<?> update(@RequestBody Book Book) {
        BookMapper.updateById(Book);
        return Result.success();
    }

    //    批量删除
    @PostMapping("/deleteBatch")
    public Result<?> deleteBatch(@RequestBody List<Integer> ids) {
        BookMapper.deleteBatchIds(ids);
        return Result.success();
    }

    @DeleteMapping("/{id}")
    public Result<?> delete(@PathVariable Long id) {
        BookMapper.deleteById(id);
        return Result.success();
    }

    @GetMapping
    public Result<?> findPage(@RequestParam(defaultValue = "1") Integer pageNum,
                              @RequestParam(defaultValue = "10") Integer pageSize,
                              @RequestParam(defaultValue = "") String search1,
                              @RequestParam(defaultValue = "") String search2,
                              @RequestParam(defaultValue = "") String search3) {
        LambdaQueryWrapper<Book> wrappers = Wrappers.<Book>lambdaQuery();
        if (StringUtils.isNotBlank(search1)) {
            wrappers.like(Book::getIsbn, search1);
        }
        if (StringUtils.isNotBlank(search2)) {
            wrappers.like(Book::getName, search2);
        }
        if (StringUtils.isNotBlank(search3)) {
            wrappers.like(Book::getAuthor, search3);
        }
        Page<Book> BookPage = BookMapper.selectPage(new Page<>(pageNum, pageSize), wrappers);
        return Result.success(BookPage);
    }
}

​​​​​​​4.1.2       BookWithUserController

This module is used to insert a new borrowing relationship entity, update the borrowing relationship through the book name and borrowing relationshipid, and update the borrowing relationship through the book name and borrowing relationship. Borrowing relationshipidDelete one or more borrowing relationship records and search the page. The specific code is as follows.

package com.example.demo.controller;

@RestController
@RequestMapping("/bookwithuser")
public class BookWithUserController {
    @Resource
    BookWithUserMapper BookWithUserMapper;

    @PostMapping("/insertNew")
    public Result<?> insertNew(@RequestBody BookWithUser BookWithUser) {
        BookWithUserMapper.insert(BookWithUser);
        return Result.success();
    }

    @PostMapping
    public Result<?> update(@RequestBody BookWithUser BookWithUser) {
        UpdateWrapper<BookWithUser> updateWrapper = new UpdateWrapper<>();
        updateWrapper.eq("isbn", BookWithUser.getIsbn()).eq("id", BookWithUser.getId());
        BookWithUserMapper.update(BookWithUser, updateWrapper);
        return Result.success();
    }

    //删除一条记录
    @PostMapping("/deleteRecord")
    public Result<?> deleteRecord(@RequestBody BookWithUser BookWithUser) {
        Map<String, Object> map = new HashMap<>();
        map.put("isbn", BookWithUser.getIsbn());
        map.put("id", BookWithUser.getId());
        BookWithUserMapper.deleteByMap(map);
        return Result.success();
    }

    @PostMapping("/deleteRecords")
    public Result<?> deleteRecords(@RequestBody List<BookWithUser> BookWithUsers) {
        int len = BookWithUsers.size();
        for (int i = 0; i < len; i++) {
            BookWithUser curRecord = BookWithUsers.get(i);
            Map<String, Object> map = new HashMap<>();
            map.put("isbn", curRecord.getIsbn());
            map.put("id", curRecord.getId());
            BookWithUserMapper.deleteByMap(map);
        }
        return Result.success();
    }

    @GetMapping
    public Result<?> findPage(@RequestParam(defaultValue = "1") Integer pageNum,
                              @RequestParam(defaultValue = "10") Integer pageSize,
                              @RequestParam(defaultValue = "") String search1,
                              @RequestParam(defaultValue = "") String search2,
                              @RequestParam(defaultValue = "") String search3) {
        LambdaQueryWrapper<BookWithUser> wrappers = Wrappers.<BookWithUser>lambdaQuery();
        if (StringUtils.isNotBlank(search1)) {
            wrappers.like(BookWithUser::getIsbn, search1);
        }
        if (StringUtils.isNotBlank(search2)) {
            wrappers.like(BookWithUser::getBookName, search2);
        }
        if (StringUtils.isNotBlank(search3)) {
            wrappers.like(BookWithUser::getId, search3);
        }
        Page<BookWithUser> BookPage = BookWithUserMapper.selectPage(new Page<>(pageNum, pageSize), wrappers);
        return Result.success(BookPage);
    }
 
}

4.1.3       DashboardController

This module is used to display the number of website visits, number of users, borrowing records, and number of books. The specific code is as follows.

package com.example.demo.controller;


@RestController
@RequestMapping("/dashboard")
public class DashboardController {
    @Resource
    private UserMapper userMapper;
    @Resource
    private LendRecordMapper lendRecordMapper;
    @Resource
    private BookMapper bookMapper;
    @GetMapping
    public  Result<?> dashboardrecords(){
        int visitCount = LoginUser.getVisitCount();
        QueryWrapper<User> queryWrapper1=new QueryWrapper();
        int userCount = userMapper.selectCount(queryWrapper1);
        QueryWrapper<LendRecord> queryWrapper2=new QueryWrapper();
        int lendRecordCount = lendRecordMapper.selectCount(queryWrapper2);
        QueryWrapper<Book> queryWrapper3=new QueryWrapper();
        int bookCount = bookMapper.selectCount(queryWrapper3);
        Map<String, Object> map = new HashMap<>();//键值对形式
        map.put("visitCount", visitCount);//放置visitCount到map中
        map.put("userCount", userCount);
        map.put("lendRecordCount", lendRecordCount);
        map.put("bookCount", bookCount);
        return Result.success(map);
    }
}

4.1.4       LendRecordController

This module is used to delete borrowing records based on book names, delete one or more borrowing records, save borrowing records, search pages, and modify borrowing records.

package com.example.demo.controller;


@RestController
@RequestMapping("/LendRecord")
public class LendRecordController {
    @Resource
    LendRecordMapper LendRecordMapper;

    @DeleteMapping("/{isbn}")
    public Result<?> delete(@PathVariable String isbn) {
        Map<String, Object> map = new HashMap<>();
        map.put("isbn", isbn);
        LendRecordMapper.deleteByMap(map);
        return Result.success();
    }

    //删除一条记录
    @PostMapping("/deleteRecord")
    public Result<?> deleteRecord(@RequestBody LendRecord LendRecord) {
        Map<String, Object> map = new HashMap<>();
        map.put("isbn", LendRecord.getIsbn());
        map.put("borrownum", LendRecord.getBorrownum());
        LendRecordMapper.deleteByMap(map);
        return Result.success();
    }

    @PostMapping("/deleteRecords")
    public Result<?> deleteRecords(@RequestBody List<LendRecord> LendRecords) {
        int len = LendRecords.size();
        for (int i = 0; i < len; i++) {
            LendRecord curRecord = LendRecords.get(i);
            Map<String, Object> map = new HashMap<>();
            map.put("isbn", curRecord.getIsbn());
            map.put("borrownum", curRecord.getBorrownum());
            LendRecordMapper.deleteByMap(map);
        }
        return Result.success();
    }

    @PostMapping
    public Result<?> save(@RequestBody LendRecord LendRecord) {
        LendRecordMapper.insert(LendRecord);
        return Result.success();
    }

    @GetMapping
    public Result<?> findPage(@RequestParam(defaultValue = "1") Integer pageNum,
                              @RequestParam(defaultValue = "10") Integer pageSize,
                              @RequestParam(defaultValue = "") String search1,
                              @RequestParam(defaultValue = "") String search2,
                              @RequestParam(defaultValue = "") String search3) {
        LambdaQueryWrapper<LendRecord> wrappers = Wrappers.<LendRecord>lambdaQuery();
        if (StringUtils.isNotBlank(search1)) {
            wrappers.like(LendRecord::getIsbn, search1);
        }
        if (StringUtils.isNotBlank(search2)) {
            wrappers.like(LendRecord::getBookname, search2);
        }
        if (StringUtils.isNotBlank(search3)) {
            wrappers.like(LendRecord::getReaderId, search3);
        }
        Page<LendRecord> LendRecordPage = LendRecordMapper.selectPage(new Page<>(pageNum, pageSize), wrappers);
        return Result.success(LendRecordPage);
    }

    @PutMapping("/{isbn}")
    public Result<?> update(@PathVariable String isbn, @RequestBody LendRecord lendRecord) {
        UpdateWrapper<LendRecord> updateWrapper = new UpdateWrapper<>();
        updateWrapper.eq("isbn", isbn);
        LendRecord lendrecord = new LendRecord();
        lendrecord.setLendTime(lendRecord.getLendTime());
        lendrecord.setReturnTime(lendRecord.getReturnTime());
        lendrecord.setStatus(lendRecord.getStatus());
        LendRecordMapper.update(lendrecord, updateWrapper);
        return Result.success();
    }

    @PutMapping("/{lendTime}")
    public Result<?> update2(@PathVariable Date lendTime, @RequestBody LendRecord lendRecord) {
        UpdateWrapper<LendRecord> updateWrapper = new UpdateWrapper<>();
        updateWrapper.eq("lendTime", lendTime);
        LendRecord lendrecord = new LendRecord();
        lendrecord.setReturnTime(lendRecord.getReturnTime());
        lendrecord.setStatus(lendRecord.getStatus());
        LendRecordMapper.update(lendrecord, updateWrapper);
        return Result.success();
    }

}

​​​​​​​ 4.1.5       UserController

This module is used for user registration, user login, inserting user information, changing password, userIDchanging password, and batch deletion, search book pages by nickname. ID

The specific implementation code is as follows:

package com.example.demo.controller;

@RestController
@RequestMapping("/user")
public class UserController {
    @Resource
    UserMapper userMapper;

    @PostMapping("/register")
    public Result<?> register(@RequestBody User user) {
        User res = userMapper.selectOne(Wrappers.<User>lambdaQuery().eq(User::getUsername, user.getUsername()));
        if (res != null) {
            return Result.error("-1", "用户名已重复");
        }
        userMapper.insert(user);
        return Result.success();
    }

    @CrossOrigin
    @PostMapping("/login")
    public Result<?> login(@RequestBody User user) {
        User res = userMapper.selectOne(Wrappers.<User>lambdaQuery().eq(User::getUsername, user.getUsername()).eq(User::getPassword, user.getPassword()));
        if (res == null) {
            return Result.error("-1", "用户名或密码错误");
        }
        String token = TokenUtils.genToken(res);
        res.setToken(token);
        LoginUser loginuser = new LoginUser();
        loginuser.addVisitCount();
        return Result.success(res);
    }

    @PostMapping
    public Result<?> save(@RequestBody User user) {
        if (user.getPassword() == null) {
            user.setPassword("abc123456");
        }
        userMapper.insert(user);
        return Result.success();
    }

    @PutMapping("/password")
    public Result<?> update(@RequestParam Integer id,
                            @RequestParam String password2) {
        UpdateWrapper<User> updateWrapper = new UpdateWrapper<>();
        updateWrapper.eq("id", id);
        User user = new User();
        user.setPassword(password2);
        userMapper.update(user, updateWrapper);
        return Result.success();
    }

    @PutMapping
    public Result<?> password(@RequestBody User user) {
        userMapper.updateById(user);
        return Result.success();
    }

    @PostMapping("/deleteBatch")
    public Result<?> deleteBatch(@RequestBody List<Integer> ids) {
        userMapper.deleteBatchIds(ids);
        return Result.success();
    }

    @DeleteMapping("/{id}")
    public Result<?> delete(@PathVariable Long id) {
        userMapper.deleteById(id);
        return Result.success();
    }

    @GetMapping
    public Result<?> findPage(@RequestParam(defaultValue = "1") Integer pageNum,
                              @RequestParam(defaultValue = "10") Integer pageSize,
                              @RequestParam(defaultValue = "") String search) {
        LambdaQueryWrapper<User> wrappers = Wrappers.<User>lambdaQuery();
        if (StringUtils.isNotBlank(search)) {
            wrappers.like(User::getNickName, search);
        }
        wrappers.like(User::getRole, 2);
        Page<User> userPage = userMapper.selectPage(new Page<>(pageNum, pageSize), wrappers);
        return Result.success(userPage);
    }

    @GetMapping("/usersearch")
    public Result<?> findPage2(@RequestParam(defaultValue = "1") Integer pageNum,
                               @RequestParam(defaultValue = "10") Integer pageSize,
                               @RequestParam(defaultValue = "") String search1,
                               @RequestParam(defaultValue = "") String search2,
                               @RequestParam(defaultValue = "") String search3,
                               @RequestParam(defaultValue = "") String search4) {
        LambdaQueryWrapper<User> wrappers = Wrappers.<User>lambdaQuery();
        if (StringUtils.isNotBlank(search1)) {
            wrappers.like(User::getId, search1);
        }
        if (StringUtils.isNotBlank(search2)) {
            wrappers.like(User::getNickName, search2);
        }
        if (StringUtils.isNotBlank(search3)) {
            wrappers.like(User::getPhone, search3);
        }
        if (StringUtils.isNotBlank(search4)) {
            wrappers.like(User::getAddress, search4);
        }
        wrappers.like(User::getRole, 2);
        Page<User> userPage = userMapper.selectPage(new Page<>(pageNum, pageSize), wrappers);
        return Result.success(userPage);
    }
}

5    Opening day

The development log of this team is as follows.

2023year7month3 Day:

l Created usingIDEAdevelopment toolsSpring Boot< /span> project, configure the basic information and dependencies of the project.

l Configure database connection information, including MySQL URL, username and password.

l Design database table structure.

l Write database initialization script, create database table and insert initial data.

2023year7month4 Day:

l IntroductionMyBatis-PlusDependence, placementMyBatis -Plus's mutual information.

l Create Service interfaces and implementation classes for modules such as book management and user management.

l Implement the addition, deletion, modification and query functions of the book management module, including adding, deleting, modifying and querying books.

l Complete the related functions of the user management module, such as user registration, login, rights management, etc.

2023year7month5 Day:

l Develop a book borrowing management module, including the functions of adding, querying and returning borrowing records.

l Implement the user rights management function and limit the rights of different operations according to user roles.

l Improve the layout and style of the front-end page.

2023year7month6 Day:

l Add a search function to query book information based on keywords.

l Improve the system's exception handling and error prompts to improve the system's robustness and user experience.

l Carry out system testing and debugging, and fix existing Bugs and problems.

2023year7month7 Day:

l Conduct project summary and evaluation, and summarize experiences and lessons learned during the development process.

l Prepare project presentations and presentation materials for project defense.

l Conduct a project defense, demonstrate the system’s functions and design ideas, and answer related questions.

6    设计总结

In this practical training class, our group designed and successfully developed a book digital management system. The goal of this system is to provide an efficient and convenient library management platform so that library administrators can easily manage the borrowing, return and inventory of books. Through the design and implementation of this practical training course, our team has realized the functions of book entry, borrowing, return and inquiry, and the system design is reasonable, the functions are complete, and the user interface is friendly. At the same time, we have a deeper understanding and practice of database design, programming technology and system integration.

In this practical training class experience, the members of our group had some common insights and gains.

Practice is the key to learning. The practical training class provides us with a practical opportunity to apply the theoretical knowledge learned in the classroom to actual projects. Through hands-on practice, we deeply understand many concepts and principles and learn how to solve practical problems.

The importance of teamwork. In the practical training class, members of our group formed a team to complete the project together. Teamwork is very critical. Through division of labor and collaborative communication, we can complete tasks efficiently. We learned how to work with others, listen to and respect others' opinions, and pursue project success together.

Have patience and perseverance in the face of challenges. During the training process, we encountered various challenges, such as technical difficulties, time pressure, etc. However, we learned to be patient and perseverant, actively look for solutions, and keep trying and learning. This makes us understand that when faced with difficulties, perseverance is the key to being able to overcome obstacles and make progress.

Pay attention to detail and quality. In the practical training class, we realized the importance of details. A small error or omission may result in system instability or loss of functionality. As a result, we learned to pay attention to details and scrutinize code and design to ensure the quality and reliability of the system.

Continuous learning and self-improvement. Practical training classes are just the starting point for learning. We realize that in the ever-evolving technical field, learning is a continuous process. We must always maintain a learning attitude, keep up with the latest technologies and trends, and constantly improve our abilities and knowledge levels.

Planning and time management. Before the start of the practical training class, we developed a detailed project plan and timetable, which helped us allocate tasks and time reasonably and avoid delays in project progress. We learned how to plan and manage our time effectively in order to complete tasks within the time limit.

Communication and collaboration skills. Teamwork is a key element of practical training sessions. We need to work closely with team members to jointly develop plans to discuss problems and solve challenges. Through communication and collaboration with others, we improve our communication skills and teamwork skills. We learned to listen to others’ perspectives, respect different opinions and play an active role in the team.

Problem-solving skills. During the training process, we encountered many technical and design problems. Sometimes we need to solve problems independently, and sometimes we need to work together as a team. We learned how to analyze problems, find solutions and take appropriate actions to solve them, which gave us a deeper understanding of the problem-solving process and enhanced our problem-solving abilities.

The combination of learning and practice. The practical training class provides a learning environment that combines theory and practice. By applying the theoretical knowledge learned to actual projects, we deepen our understanding of the course content and master the practical skills. Applied skills are a learning method that allows us to grow through practice and transform knowledge into practical abilities.

Self-reflection and continuous improvement. During the practical training class, we constantly reflect on our performance and learning progress. We are aware of our strengths and weaknesses and actively take measures to improve ourselves. Through continuous self-reflection and improvement, we can continuously improve our skills and abilities.

Through this practical training class, our group not only gained experience in actual project development, but also developed self-management teamwork and problem-solving abilities. These valuable experiences will have a long-term impact on the future learning and career development of the members of our group, and we look forward to applying these experiences to future projects and challenges, and to continuing to grow and improve ourselves.

Coding is not easy. Please share the code and original documents for free. If you are interested in privately chatting about VX: liwoaa

Guess you like

Origin blog.csdn.net/Liwo4418/article/details/131713651