跳到主要内容
极客日志极客日志面向AI+效率的开发者社区
首页博客GitHub 精选镜像工具UI配色美学隐私政策关于联系
搜索内容 / 工具 / 仓库 / 镜像...⌘K搜索
注册
博客列表
Java大前端java

基于 SpringBoot 与 Vue 的酒店客房管理系统

综述由AI生成一款基于 SpringBoot 后端、Vue 前端和 MySQL 数据库的酒店客房管理系统。系统采用前后端分离架构,包含客房信息管理、客户预订管理、订单结算及员工权限管理等核心模块。通过 RESTful API 实现数据交互,支持多角色登录与权限控制。文中提供了关键数据表结构及核心后端代码示例,旨在为酒店行业提供数字化解决方案,便于二次开发与部署。

林间仙子发布于 2026/4/6更新于 2026/5/2337 浏览
基于 SpringBoot 与 Vue 的酒店客房管理系统

项目背景

随着旅游业的快速发展和酒店行业的不断扩张,传统的酒店客房管理方式已难以满足现代化管理的需求。人工操作效率低下、信息易丢失、管理流程繁琐等问题日益凸显,亟需一套高效、智能的酒店客房管理系统来提升运营效率和服务质量。数字化管理不仅能减少人力成本,还能通过数据分析优化客房资源配置,提升客户满意度。

本系统采用前后端分离架构,后端基于 SpringBoot 框架实现高效的数据处理和业务逻辑,前端使用 Vue.js 构建动态交互界面,数据库采用 MySQL 存储数据。系统功能包括客房信息管理、客户预订管理、订单结算、员工权限管理等模块,支持多角色登录和权限控制。通过响应式设计和 RESTful API 接口,系统实现了数据的实时更新和高效交互。

数据表

客房信息数据表

客房信息数据表中,房型编号是该表的主键,存储客房的基本属性信息,包括房型名称、价格、状态等。创建时间通过函数自动获取,确保数据的时效性。

字段名数据类型说明
room_idINT房型编号(主键)
room_typeVARCHAR(50)房型名称
room_priceDECIMAL(10,2)每日价格
room_statusVARCHAR(20)房间状态(空闲/占用)
room_descriptionTEXT房型描述
create_timeDATETIME创建时间
客户预订数据表

客户预订数据表中,订单编号是该表的主键,存储客户预订的详细信息,包括客户姓名、联系方式、入住时间等。

字段名数据类型说明
order_idINT订单编号(主键)
customer_nameVARCHAR(50)客户姓名
customer_phoneVARCHAR(20)客户联系方式
check_in_dateDATE入住日期
check_out_dateDATE离店日期
room_idINT关联房型编号
order_statusVARCHAR(20)订单状态(已确认/取消)
员工权限数据表

员工权限数据表中,员工编号是该表的主键,存储员工的基本信息和权限级别。密码通过加密存储,确保数据安全性。

字段名数据类型说明
staff_idINT员工编号(主键)
staff_nameVARCHAR(50)员工姓名
staff_account
VARCHAR(50)
员工账号
staff_passwordVARCHAR(100)加密密码
staff_roleVARCHAR(20)权限级别(管理员/普通)
create_timeDATETIME创建时间

技术架构

后端技术:Spring Boot

Spring Boot 作为现代 Java 企业级开发的核心框架,以其'约定优于配置'的设计哲学重新定义了应用开发模式。核心特性包括零配置启动、嵌入式服务器(Tomcat/Jetty/Undertow)、生产就绪监控组件以及微服务友好架构。通过 Starter 依赖体系和智能自动装配,开发者可将精力完全聚焦于业务逻辑实现。

前端技术:Vue.js

Vue.js 以其渐进式框架设计和卓越的开发体验,成为现代前端开发的首选解决方案。技术亮点包括响应式数据流、组件化架构(SFC)、灵活的渐进式设计以及丰富的生态系统(Vue Router、Vuex/Pinia)。直观的模板语法结合强大的指令系统,让复杂的用户交互变得简洁明了。

核心代码

package com;

import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;

@SpringBootApplication
@MapperScan(basePackages = {"com.dao"})
public class SpringbootSchemaApplication extends SpringBootServletInitializer {
    public static void main(String[] args) {
        SpringApplication.run(SpringbootSchemaApplication.class, args);
    }

    @Override
    protected SpringApplicationBuilder configure(SpringApplicationBuilder applicationBuilder) {
        return applicationBuilder.sources(SpringbootSchemaApplication.class);
    }
}
package com.controller;

import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Map;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Date;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import com.utils.ValidatorUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.annotation.IgnoreAuth;
import com.entity.YonghuEntity;
import com.entity.view.YonghuView;
import com.service.YonghuService;
import com.service.TokenService;
import com.utils.PageUtils;
import com.utils.R;
import com.utils.MPUtil;
import com.utils.MapUtils;
import com.utils.CommonUtil;
import java.io.IOException;

/**
 * 用户
 * 后端接口
 */
@RestController
@RequestMapping("/yonghu")
public class YonghuController {
    @Autowired
    private YonghuService yonghuService;
    @Autowired
    private TokenService tokenService;

    /**
     * 登录
     */
    @IgnoreAuth
    @RequestMapping(value = "/login")
    public R login(String username, String password, String captcha, HttpServletRequest request) {
        YonghuEntity u = yonghuService.selectOne(new EntityWrapper<YonghuEntity>().eq("yonghuzhanghao", username));
        if (u == null || !u.getMima().equals(password)) {
            return R.error("账号或密码不正确");
        }
        String token = tokenService.generateToken(u.getId(), username, "yonghu", "用户");
        return R.ok().put("token", token);
    }

    /**
     * 注册
     */
    @IgnoreAuth
    @RequestMapping("/register")
    public R register(@RequestBody YonghuEntity yonghu) {
        YonghuEntity u = yonghuService.selectOne(new EntityWrapper<YonghuEntity>().eq("yonghuzhanghao", yonghu.getYonghuzhanghao()));
        if (u != null) {
            return R.error("注册用户已存在");
        }
        Long uId = new Date().getTime();
        yonghu.setId(uId);
        yonghuService.insert(yonghu);
        return R.ok();
    }

    /**
     * 退出
     */
    @RequestMapping("/logout")
    public R logout(HttpServletRequest request) {
        request.getSession().invalidate();
        return R.ok("退出成功");
    }

    /**
     * 获取用户的 session 用户信息
     */
    @RequestMapping("/session")
    public R getCurrUser(HttpServletRequest request) {
        Long id = (Long) request.getSession().getAttribute("userId");
        YonghuEntity u = yonghuService.selectById(id);
        return R.ok().put("data", u);
    }

    /**
     * 密码重置
     */
    @IgnoreAuth
    @RequestMapping(value = "/resetPass")
    public R resetPass(String username, HttpServletRequest request) {
        YonghuEntity u = yonghuService.selectOne(new EntityWrapper<YonghuEntity>().eq("yonghuzhanghao", username));
        if (u == null) {
            return R.error("账号不存在");
        }
        u.setMima("123456");
        yonghuService.updateById(u);
        return R.ok("密码已重置为:123456");
    }

    /**
     * 后台列表
     */
    @RequestMapping("/page")
    public R page(@RequestParam Map<String, Object> params, YonghuEntity yonghu, HttpServletRequest request) {
        EntityWrapper<YonghuEntity> ew = new EntityWrapper<YonghuEntity>();
        PageUtils page = yonghuService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, yonghu), params), params));
        return R.ok().put("data", page);
    }

    /**
     * 前台列表
     */
    @IgnoreAuth
    @RequestMapping("/list")
    public R list(@RequestParam Map<String, Object> params, YonghuEntity yonghu, HttpServletRequest request) {
        EntityWrapper<YonghuEntity> ew = new EntityWrapper<YonghuEntity>();
        PageUtils page = yonghuService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, yonghu), params), params));
        return R.ok().put("data", page);
    }

    /**
     * 列表
     */
    @RequestMapping("/lists")
    public R list(YonghuEntity yonghu) {
        EntityWrapper<YonghuEntity> ew = new EntityWrapper<YonghuEntity>();
        ew.allEq(MPUtil.allEQMapPre(yonghu, "yonghu"));
        return R.ok().put("data", yonghuService.selectListView(ew));
    }

    /**
     * 查询
     */
    @RequestMapping("/query")
    public R query(YonghuEntity yonghu) {
        EntityWrapper<YonghuEntity> ew = new EntityWrapper<YonghuEntity>();
        ew.allEq(MPUtil.allEQMapPre(yonghu, "yonghu"));
        YonghuView yonghuView = yonghuService.selectView(ew);
        return R.ok("查询用户成功").put("data", yonghuView);
    }

    /**
     * 后台详情
     */
    @RequestMapping("/info/{id}")
    public R info(@PathVariable("id") Long id) {
        YonghuEntity yonghu = yonghuService.selectById(id);
        return R.ok().put("data", yonghu);
    }

    /**
     * 前台详情
     */
    @IgnoreAuth
    @RequestMapping("/detail/{id}")
    public R detail(@PathVariable("id") Long id) {
        YonghuEntity yonghu = yonghuService.selectById(id);
        return R.ok().put("data", yonghu);
    }

    /**
     * 后台保存
     */
    @RequestMapping("/save")
    public R save(@RequestBody YonghuEntity yonghu, HttpServletRequest request) {
        if (yonghuService.selectCount(new EntityWrapper<YonghuEntity>().eq("yonghuzhanghao", yonghu.getYonghuzhanghao())) > 0) {
            return R.error("用户账号已存在");
        }
        yonghu.setId(new Date().getTime() + new Double(Math.floor(Math.random() * 1000)).longValue());
        YonghuEntity u = yonghuService.selectOne(new EntityWrapper<YonghuEntity>().eq("yonghuzhanghao", yonghu.getYonghuzhanghao()));
        if (u != null) {
            return R.error("用户已存在");
        }
        yonghu.setId(new Date().getTime());
        yonghuService.insert(yonghu);
        return R.ok();
    }

    /**
     * 前台保存
     */
    @RequestMapping("/add")
    public R add(@RequestBody YonghuEntity yonghu, HttpServletRequest request) {
        if (yonghuService.selectCount(new EntityWrapper<YonghuEntity>().eq("yonghuzhanghao", yonghu.getYonghuzhanghao())) > 0) {
            return R.error("用户账号已存在");
        }
        yonghu.setId(new Date().getTime() + new Double(Math.floor(Math.random() * 1000)).longValue());
        YonghuEntity u = yonghuService.selectOne(new EntityWrapper<YonghuEntity>().eq("yonghuzhanghao", yonghu.getYonghuzhanghao()));
        if (u != null) {
            return R.error("用户已存在");
        }
        yonghu.setId(new Date().getTime());
        yonghuService.insert(yonghu);
        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    @Transactional
    public R update(@RequestBody YonghuEntity yonghu, HttpServletRequest request) {
        if (yonghuService.selectCount(new EntityWrapper<YonghuEntity>().ne("id", yonghu.getId()).eq("yonghuzhanghao", yonghu.getYonghuzhanghao())) > 0) {
            return R.error("用户账号已存在");
        }
        yonghuService.updateById(yonghu);
        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    public R delete(@RequestBody Long[] ids) {
        yonghuService.deleteBatchIds(Arrays.asList(ids));
        return R.ok();
    }
}

目录

  1. 项目背景
  2. 数据表
  3. 客房信息数据表
  4. 客户预订数据表
  5. 员工权限数据表
  6. 技术架构
  7. 核心代码
  • 💰 8折买阿里云服务器限时8折了解详情
  • Magick API 一键接入全球大模型注册送1000万token查看
  • 🤖 一键搭建Deepseek满血版了解详情
  • 一键打造专属AI 智能体了解详情
极客日志微信公众号二维码

微信扫一扫,关注极客日志

微信公众号「极客日志V2」,在微信中扫描左侧二维码关注。展示文案:极客日志V2 zeeklog

更多推荐文章

查看全部
  • faster-whisper 语音转文字工具入门与性能优化
  • 使用文心一言为智能体设计稳定调用工作流的提示词
  • MySQL 常用函数实战:字符串、日期与聚合函数
  • VSCode 远程 SSH 连接下 Copilot Claude Agent 异常修复
  • FAST-LIVO2 算法解析与实战:多传感器融合 SLAM 技术详解
  • OpenCode 开源 AI 编程代理技术与行业分析
  • GitHub Copilot 登录失败常见原因与排查指南
  • OpenClaw 本地推理方案:基于 Ollama 部署开源模型替代云端 Token 消耗
  • JS 逆向断点调试与前端加密对抗及企业 SRC 实战案例
  • 为什么 AI 生成的 Verilog 代码难以直接使用?
  • Spring Boot 默认连接池 HikariCP 配置详解
  • 磁力链接、BT 种子与 DHT 网络原理及 Go 实现
  • LFM2.5-1.2B-Thinking 实战:打造个人 AI 写作助手
  • RoboBrain2.0 具身大脑模型复现指南:统一感知推理与规划
  • OpenClaw 接入飞书配置教程
  • 告别从零开发!AI+AR眼镜开源方案来了|PUSHI G1赋能18个全场景,联动腾讯/阿里云落地
  • Docker 运行 hello-world 镜像失败或超时问题排查与解决
  • 机器人操作VLA模型的强化学习:综述
  • Qwen3-VL 模型架构与训练流程
  • Flutter web_scraper 库在 OpenHarmony 环境下的网页抓取适配实战

相关免费在线工具

  • Keycode 信息

    查找任何按下的键的javascript键代码、代码、位置和修饰符。 在线工具,Keycode 信息在线工具,online

  • Escape 与 Native 编解码

    JavaScript 字符串转义/反转义;Java 风格 \uXXXX(Native2Ascii)编码与解码。 在线工具,Escape 与 Native 编解码在线工具,online

  • JavaScript / HTML 格式化

    使用 Prettier 在浏览器内格式化 JavaScript 或 HTML 片段。 在线工具,JavaScript / HTML 格式化在线工具,online

  • JavaScript 压缩与混淆

    Terser 压缩、变量名混淆,或 javascript-obfuscator 高强度混淆(体积会增大)。 在线工具,JavaScript 压缩与混淆在线工具,online

  • Base64 字符串编码/解码

    将字符串编码和解码为其 Base64 格式表示形式即可。 在线工具,Base64 字符串编码/解码在线工具,online

  • Base64 文件转换器

    将字符串、文件或图像转换为其 Base64 表示形式。 在线工具,Base64 文件转换器在线工具,online