Design and Implementation of Seat Reservation Management System

Foreword:
Happy Dragon Boat Festival, my friends. This article brings you a project based on ssm technology. Children who are learning this technology can experience it. You can get the source code in the resources ~ the following
insert image description here
text start:

demand analysis

With the progress of society, informatization has become the development trend of the whole society. The ssm-based seat reservation management system not only has most of the functions of the traditional management system, but also can meet the regular and special needs of the administrator, and is quick to operate, and the realization technology is relatively mature, so it is loved by people. The seat reservation system is a system that has the functions of statistics and management of users and various seat reservation related information, and is convenient for managers to manage the seats of libraries and study rooms in a unified manner. The administrator can perform specific operations and management of seats on the system. There is a large group of seat users, and orderly recording seat reservation information can make the system more prominent in the current seat reservation management. Therefore, this system provides multiple management The specific requirements for the staff to manage and operate the seat information.

functional module

This reserved seat management system provides a very convenient and fast platform for managers. Managers can log in to the system to search for user information and handle seat reservations.
The system should implement the following functions:

  1. Login module: You need to enter the user's user name and password to enter the system.
  2. System setting module:
    (1) User management: This module can provide the administrator with a user list, user detailed information, and perform operations such as adding, searching, modifying, and deleting user information.
    (2) Seat management: This module can provide the administrator with a seat list, seat details, and perform operations such as adding, searching, modifying, and deleting seat information (3) Reservation management: This module can provide the administrator with adding
    reservations Seat orders, query the user's use of seats and detailed information, delete reservation orders, etc.
    (4). Modify password settings: modify the user login password.

Project Architecture Diagram

The functional modules of the seat reservation system are divided into four major parts. The users of the system include system administrators, teachers, and students with triple identities. First, identity verification is performed. Information, management teacher information, compulsory course information for each class in each semester of the management class, teacher information for each course, and student information for each course; and teachers can log in to the system to query the information of the courses they teach; student users can choose courses after logging in to the system , and view course information and more. The functional block diagram of the system is shown in the figure below.

insert image description here

home section

The following is the home page part of the login, which can perform the login function. The source code is as follows:
insert image description here

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%--
    格式化的标签库
--%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title>座位预约管理系统</title>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/static/css/public.css"/>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/static/css/style.css"/>
</head>
<body>
<!--头部-->
<header class="publicHeader">
    <h1>座位预约管理系统</h1>

    <div class="publicHeaderR">
        <p><span>下午好!</span><span style="color: #fff21b"> ${loginUser.username}</span> , 欢迎你!</p>
        <a href="${pageContext.request.contextPath}/toLogin">退出</a>
    </div>
</header>
<!--时间-->
<section class="publicTime">
    <span id="time">2028年1月1日 11:11  星期一</span>
    <a href="#">温馨提示:为了能正常浏览,请使用高版本浏览器!(IE10+)</a>
</section>
<!--主体内容-->
<section class="publicMian">
    <div class="left">
        <h2 class="leftH2"><span class="span1"></span>功能列表 <span></span></h2>
        <nav>
            <ul class="list">
                <li ><a href="${pageContext.request.contextPath}/bill/list">预约管理</a></li>
                <li><a href="${pageContext.request.contextPath}/provider/list">座位管理</a></li>
                <li><a href="${pageContext.request.contextPath}/user/list">用户管理</a></li>
                <li><a href="${pageContext.request.contextPath}/user/toUpdatePwd">密码修改</a></li>
                <li><a href="${pageContext.request.contextPath}/toLogin">退出系统</a></li>
            </ul>
        </nav>
    </div>
    <div class="right">
        <div class="location">
            <strong>你现在所在的位置是:</strong>
            <span>用户管理页面 >> 用户信息查看页面</span>
        </div>
        <div class="providerView">
            <p><strong>用户名:</strong><span>${user.username}</span></p>
            <p><strong>真实姓名:</strong><span>${user.realName}</span></p>
            <p>
                <strong>用户性别:</strong>
                <span>
                    <c:if test="${user.gender == 1}"></c:if>
                    <c:if test="${user.gender == 2}"></c:if>
                </span>
            </p>
            <p><strong>出生日期:</strong>
                <span>
                <fmt:formatDate value="${user.birthday}" pattern="yyyy-MM-dd"></fmt:formatDate>
                </span>
            </p>
            <p><strong>用户类别:</strong>
                <span>
                    <c:if test="${user.userType == 1}">管理员</c:if>
                    <c:if test="${user.userType == 2}">经理</c:if>
                    <c:if test="${user.userType == 3}">普通用户</c:if>
                </span>
            </p>
            <a onclick="history.back(-1)" href="#">返回</a>
        </div>
    </div>
</section>
<footer class="footer"><div style="text-align:center;">	<p><a href="http://#/" target="_blank">Bill #</a> 版权所有</p></div></footer>

<script src="js/time.js"></script>


</body>
</html>

Controller layer

insert image description here

The controller layer mainly calls the services of the service layer to complete the access and mapping of adding, deleting, modifying and checking urls. Part of the detailed code is as follows:

package com.rg.controller;

import com.rg.entity.Bill;
import com.rg.entity.Provider;
import com.rg.entity.User;
import com.rg.service.BillService;
import com.rg.service.ProviderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;mapper

@Controller
@RequestMapping("/bill")
public class BillController {
    
    

    @Autowired
    BillService billService;

    @Autowired
    ProviderService providerService;

    @RequestMapping("/list")
    public String billList(Model model){
    
    
        //bill列表
        List<Bill> billList = billService.billList();
        //供应商的列表
        List<Provider> providerList = providerService.providerList();

        model.addAttribute("providerList",providerList);
        model.addAttribute("billList",billList);
        return "bill/list";
    }

    //条件查询
    @RequestMapping("/queryBill")
    public String queryBill(Bill bill,Model model){
    
    
        System.out.println("=================================");
        System.out.println("bill = " + bill);

        //bill列表
        List<Bill> billList = billService.queryBill(bill);

        //供应商的列表
        List<Provider> providerList = providerService.providerList();

        //条件回显
        model.addAttribute("bill",bill);

        model.addAttribute("providerList",providerList);
        model.addAttribute("billList",billList);
        return "bill/list";
    }

    //findBillById

    //findBillById
    @RequestMapping("/findBillById")
    public String findBillById(int bid,Model model,String type){
    
    
        //查询数据库
        Bill bill = billService.findBillById(bid);

        //供应商的列表
        List<Provider> providerList = providerService.providerList();
        model.addAttribute("providerList",providerList);

        model.addAttribute("bill",bill);

        if("view".equals(type)){
    
    
            return "bill/view";
        }
        return "bill/update";
    }

    //更新操作
    @RequestMapping("/updateBill")
    public String updateBill(Bill Bill,Model model){
    
    

        int row = billService.updateBill( Bill);
        if(row == 1){
    
    
            //更新成功重定向到list页面
            return "redirect:list";
        }
        model.addAttribute("errorMsg","更新失败");
        return "bill/update";
    }
    /*
     * 跳转到添加页面
     * */
    @RequestMapping("/toAddBill")

    public String toAddBill(Model model){
    
    
        List<Provider> providerList = providerService.providerList();
        model.addAttribute("providerList",providerList);
        return "bill/add";
    }

    /*
     * 添加预约
     * */
    @RequestMapping("/addBill")
    public String addBill(Bill bill, Model model){
    
    
        int row = billService.addBill(bill);

        if(row==1){
    
    
            //插入成功 重定向到list页面,
            // 相对路径 当前路径 /user/addUser  list路径为 /user/list
            return "redirect:list";
        }
        //添加失败 重新回到添加页面
        model.addAttribute("errorMsg","添加失败!!!");
        return "bill/add";
    }

    //删除操作
    @RequestMapping("/deleteBillById")
    public String deleteBillById(int bid,Model model){
    
    
        int row = billService.deleteBillById( bid);
        return "redirect:list";
    }

}

Service layer

insert image description here

The Service layer mainly corresponds to and invokes the methods of the mapper layer. Part of the source code is as follows:

@Service
public class BillService {
    
    

    @Autowired
    BillMapper billMapper;

    public List<Bill> billList() {
    
    
        return billMapper.billList();
    }

    public List<Bill> queryBill(Bill bill) {
    
    
        return billMapper.queryBill(bill);
    }

    public Bill findBillById(int bid) {
    
    
        return billMapper.findBillById(bid);
    }

    public int addBill(Bill bill) {
    
    
        return billMapper.addBill(bill);
    }

    public int updateBill(Bill bill) {
    
    
        return billMapper.updateBill(bill);
    }

    public int deleteBillById(int bid) {
    
    
        return billMapper.deleteBillById(bid);
    }
}

Mapper layer

insert image description here

The Mapper layer is mainly used to interact with the database and write corresponding SQL statements, etc. Part of the source code is as follows:

public interface BillMapper {
    
    
    List<Bill> billList();

    List<Bill> queryBill(Bill bill);

    Bill findBillById(int bid);

    int addBill(Bill bill);

    int updateBill(Bill bill);

    int deleteBillById(int bid);
}
<mapper namespace="com.rg.mapper.BillMapper">

    <resultMap id="billProviderMap" type="bill">
        <id property="bid" column="bid"></id>
        <result property="billCode" column="bill_code"></result>
        <result property="billName" column="bill_name"></result>
        <result property="billCom" column="bill_com"></result>
        <result property="billNum" column="bill_num"></result>
        <result property="money" column="money"></result>
        <result property="pay" column="pay"></result>
        <result property="createDate" column="create_date"></result>
        <!--
            一对一关系的标签:
        -->
        <association property="provider" javaType="Provider">
            <id property="pid" column="pid"></id>
            <result property="providerName" column="providerName"></result>
        </association>
    </resultMap>
    <select id="billList" resultMap="billProviderMap">
        select bill.*,provider.providerName
        from bill,provider
        where bill.pid = provider.pid
    </select>

    <!--条件查询-->
    <select id="queryBill" resultMap="billProviderMap" parameterType="bill">
        select bill.*,provider.providerName
        from bill,provider
        where bill.pid = provider.pid
        <if test="billName != null and billName !='' ">
            and  bill_name like '%${billName}%'
        </if>

        <if test="provider != null and provider.pid !=null and provider.pid !=''">
            and  provider.pid = #{provider.pid}
        </if>
        <if test=" pay!= 3">
            and  pay = #{pay}
        </if>
    </select>

    <!--通过id查询-->
    <select id="findBillById" resultMap="billProviderMap" >
        select bill.*,provider.providerName
        from bill,provider
        where bill.pid = provider.pid and bid =#{bid}
    </select>
    <!--
            添加预约
        -->
    <insert id="addBill" parameterType="bill">
        INSERT INTO `bill` ( `bill_code`, `bill_name`, `bill_com`, `bill_num`, `money`, `pay`,`pid`)
        VALUES (#{billCode}, #{billName}, #{billCom}, #{billNum}, #{money}, #{pay},#{provider.pid})
    </insert>
    <!--更新-->
    <update id="updateBill" parameterType="bill">
        UPDATE `bill`
        SET  `bill_code`=#{billCode}, `bill_name`=#{billName},
             `bill_com`=#{billCom}, `bill_num`=#{billNum}, `money`=#{money},
              `pay`=#{pay}, `pid`= #{provider.pid}
        WHERE bid=#{bid};
    </update>

    <!--删除-->
    <delete id="deleteBillById">
        delete from bill where bid = #{bid}
    </delete>

</mapper>

At the same time, the administrator also has the authority to modify the user management part:
insert image description here
the article ends here first, and those who are interested can download the resources to try to learn, and will continue to share relevant knowledge points in the future.

insert image description here

Guess you like

Origin blog.csdn.net/qq_53847859/article/details/131339234