文章目录
- 酒店管理系统
- 一、项目演示
- 二、项目介绍
- 三、15000字论文参考
- 四、部分功能截图
- 五、部分代码展示
- 六、底部获取项目源码和万字论文参考(9.9¥带走)
酒店管理系统
一、项目演示
酒店管理系统
二、项目介绍
基于springboot+vue前后端分离的酒店管理系统
角色分为用户和管理员
用户:注册、登录、查询空余房间、房间预约、我的(查看预约订单)、评论
管理员:登录、用户管理、订单管理(处理酒店预约订单、查看订单列表)、房间管理(房间列表、详情查询、添加房间、修改房间)、评论列表
项目技术
语言:java
前端技术:vue、element-ui
后端技术:springboot、mybatisplus
数据库:MySQL
三、15000字论文参考
四、部分功能截图
五、部分代码展示
package com.rabbiter.hotel.controller.admin;import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.rabbiter.hotel.common.CommonResult;
import com.rabbiter.hotel.common.StatusCode;
import com.rabbiter.hotel.domain.Order;
import com.rabbiter.hotel.domain.User;
import com.rabbiter.hotel.service.OrderService;
import com.rabbiter.hotel.service.RoomService;
import com.rabbiter.hotel.service.UserService;
import org.springframework.web.bind.annotation.*;import javax.annotation.Resource;
import java.util.List;/*** @author:rabbiter* @date:2023/01/01 13:08* Description:*/
@RestController("adminOrderController")
@RequestMapping("/admin")
public class OrderController {@Resourceprivate OrderService orderService;@Resourceprivate RoomService roomService;@Resourceprivate UserService userService;@GetMapping("/listOrders")public CommonResult<List<Order>> listOrders(@RequestParam("orderFlags") List<Integer> flags) {CommonResult<List<Order>> commonResult = new CommonResult<>();QueryWrapper queryWrapper = new QueryWrapper();queryWrapper.in("flag", flags);List<Order> userList = orderService.list(queryWrapper);commonResult.setCode(StatusCode.COMMON_SUCCESS.getCode());commonResult.setMessage(StatusCode.COMMON_SUCCESS.getMessage());commonResult.setData(userList);return commonResult;}@PostMapping("/unsubscribe")public CommonResult<String> unsubscribe(@RequestParam("orderId") Integer orderId) {CommonResult<String> commonResult = new CommonResult<>();Order order = orderService.getById(orderId);order.setFlag(2);boolean result = orderService.updateById(order);if (result) {commonResult.setCode(StatusCode.COMMON_SUCCESS.getCode());commonResult.setMessage(StatusCode.COMMON_SUCCESS.getMessage());commonResult.setData("退订成功");} else {commonResult.setCode(StatusCode.COMMON_FAIL.getCode());commonResult.setMessage(StatusCode.COMMON_FAIL.getMessage());commonResult.setData("退订失败");}return commonResult;}@PostMapping("/handle")public CommonResult<String> handle(@RequestParam("orderId") Integer orderId) {CommonResult<String> commonResult = new CommonResult<>();Order order = orderService.getById(orderId);order.setFlag(1);boolean result = orderService.updateById(order);if (result) {roomService.bookRoom(order.getRoomId());User user = userService.getById(order.getUserId());int jifen = (int) (user.getJifen() + order.getRealPrice());user.setJifen(jifen);userService.updateById(user);commonResult.setCode(StatusCode.COMMON_SUCCESS.getCode());commonResult.setMessage(StatusCode.COMMON_SUCCESS.getMessage());commonResult.setData("办理入住成功");} else {commonResult.setCode(StatusCode.COMMON_FAIL.getCode());commonResult.setMessage(StatusCode.COMMON_FAIL.getMessage());commonResult.setData("办理入住失败");}return commonResult;}
}
package com.rabbiter.hotel.controller.admin;import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.rabbiter.hotel.common.CommonResult;
import com.rabbiter.hotel.common.StatusCode;
import com.rabbiter.hotel.domain.Order;
import com.rabbiter.hotel.domain.Room;
import com.rabbiter.hotel.dto.AdminReturnRoomDTO;
import com.rabbiter.hotel.dto.DateSectionDTO;
import com.rabbiter.hotel.service.OrderService;
import com.rabbiter.hotel.service.RoomService;
import org.springframework.web.bind.annotation.*;import javax.annotation.Resource;
import java.util.List;/*** @author:rabbiter* @date:2023/01/01 13:08* Description:*/
@RestController("adminRoomController")
@RequestMapping("/admin")
public class RoomController {@Resourceprivate RoomService roomService;@Resourceprivate OrderService orderService;@GetMapping("/listRooms")public CommonResult<List<Room>> listRooms() {CommonResult<List<Room>> commonResult = new CommonResult<>();List<Room> roomList = roomService.list();commonResult.setCode(StatusCode.COMMON_SUCCESS.getCode());commonResult.setMessage(StatusCode.COMMON_SUCCESS.getMessage());commonResult.setData(roomList);return commonResult;}@PostMapping(value = "/roomDetail")public CommonResult<AdminReturnRoomDTO> roomDetail(@RequestParam("roomId") Integer roomId) {CommonResult<AdminReturnRoomDTO> commonResult = new CommonResult<>();AdminReturnRoomDTO returnRoomDTO = roomService.adminRoomDetail(roomId);commonResult.setData(returnRoomDTO);commonResult.setCode(StatusCode.COMMON_SUCCESS.getCode());commonResult.setMessage(StatusCode.COMMON_SUCCESS.getMessage());return commonResult;}@PostMapping("/addRoom")public CommonResult<String> addRoom(@RequestBody Room room) {CommonResult<String> commonResult = new CommonResult<>();Room roomByNumber = roomService.getOne(new QueryWrapper<Room>().eq("number", room.getNumber()));if(roomByNumber != null) {commonResult.setCode(StatusCode.COMMON_FAIL.getCode());commonResult.setMessage(StatusCode.COMMON_FAIL.getMessage());commonResult.setData("房间号已存在");return commonResult;}boolean result = roomService.save(room);if (result) {commonResult.setCode(StatusCode.COMMON_SUCCESS.getCode());commonResult.setMessage(StatusCode.COMMON_SUCCESS.getMessage());commonResult.setData("添加房间成功");} else {commonResult.setCode(StatusCode.COMMON_FAIL.getCode());commonResult.setMessage(StatusCode.COMMON_FAIL.getMessage());commonResult.setData("添加房间失败");}return commonResult;}@PostMapping("/updateRoom")public CommonResult<String> updateRoom(@RequestBody Room room) {CommonResult<String> commonResult = new CommonResult<>();Room roomByNumber = roomService.getOne(new QueryWrapper<Room>().eq("number", room.getNumber()).ne("id", room.getId()));if(roomByNumber != null) {commonResult.setCode(StatusCode.COMMON_FAIL.getCode());commonResult.setMessage(StatusCode.COMMON_FAIL.getMessage());commonResult.setData("房间号已存在");return commonResult;}boolean result = roomService.updateById(room);if (result) {commonResult.setCode(StatusCode.COMMON_SUCCESS.getCode());commonResult.setMessage(StatusCode.COMMON_SUCCESS.getMessage());commonResult.setData("修改房间信息成功");} else {commonResult.setCode(StatusCode.COMMON_FAIL.getCode());commonResult.setMessage(StatusCode.COMMON_FAIL.getMessage());commonResult.setData("修改房间信息失败");}return commonResult;}@PostMapping("/deleteRoom")public CommonResult<String> deleteRoom(@RequestParam("roomId") Integer roomId) {CommonResult<String> commonResult = new CommonResult<>();// 移除关联订单orderService.remove(new QueryWrapper<Order>().eq("room_id", roomId));boolean result = roomService.removeById(roomId);if (result) {QueryWrapper queryWrapper = new QueryWrapper();queryWrapper.eq("room_id", roomId);orderService.remove(queryWrapper);commonResult.setCode(StatusCode.COMMON_SUCCESS.getCode());commonResult.setMessage(StatusCode.COMMON_SUCCESS.getMessage());commonResult.setData("删除房间成功");} else {commonResult.setCode(StatusCode.COMMON_FAIL.getCode());commonResult.setMessage(StatusCode.COMMON_FAIL.getMessage());commonResult.setData("删除房间失败");}return commonResult;}}
package com.rabbiter.hotel.controller.admin;import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.rabbiter.hotel.common.CommonResult;
import com.rabbiter.hotel.common.StatusCode;
import com.rabbiter.hotel.domain.Comment;
import com.rabbiter.hotel.domain.Order;
import com.rabbiter.hotel.domain.User;
import com.rabbiter.hotel.service.CommentService;
import com.rabbiter.hotel.service.OrderService;
import com.rabbiter.hotel.service.UserService;
import org.springframework.web.bind.annotation.*;import javax.annotation.Resource;
import java.util.List;/*** @author:rabbiter* @date:2023/01/01 13:08* Description:*/
@RestController("adminUserController")
@RequestMapping("/admin")
public class UserController {@Resourceprivate UserService userService;@Resourceprivate OrderService orderService;@Resourceprivate CommentService commentService;@GetMapping("/listUsers")public CommonResult<List<User>> listUsers() {CommonResult<List<User>> commonResult = new CommonResult<>();List<User> userList = userService.list();commonResult.setCode(StatusCode.COMMON_SUCCESS.getCode());commonResult.setMessage(StatusCode.COMMON_SUCCESS.getMessage());commonResult.setData(userList);return commonResult;}@PostMapping("/deleteUser")public CommonResult<String> deleteUser(@RequestParam("userId") Integer userId) {CommonResult<String> commonResult = new CommonResult<>();// 移除关联订单orderService.remove(new QueryWrapper<Order>().eq("user_id", userId));// 移除关联评论commentService.remove(new QueryWrapper<Comment>().eq("user_id", userId));boolean result = userService.removeById(userId);if (result) {commonResult.setCode(StatusCode.COMMON_SUCCESS.getCode());commonResult.setMessage(StatusCode.COMMON_SUCCESS.getMessage());commonResult.setData("删除成功");} else {commonResult.setCode(StatusCode.COMMON_FAIL.getCode());commonResult.setMessage(StatusCode.COMMON_FAIL.getMessage());commonResult.setData("删除失败");}return commonResult;}@PostMapping("/updateUser")public CommonResult<String> updateUser(@RequestBody User user) {CommonResult<String> commonResult = new CommonResult<>();boolean result = userService.updateById(user);if (result) {commonResult.setCode(StatusCode.COMMON_SUCCESS.getCode());commonResult.setMessage(StatusCode.COMMON_SUCCESS.getMessage());commonResult.setData("修改成功");} else {commonResult.setCode(StatusCode.COMMON_FAIL.getCode());commonResult.setMessage(StatusCode.COMMON_FAIL.getMessage());commonResult.setData("修改失败");}return commonResult;}@PostMapping("/getUserById")public CommonResult<User> getUserById(@RequestParam("userId") Integer userId) {CommonResult<User> commonResult = new CommonResult<>();User user = userService.getById(userId);commonResult.setCode(StatusCode.COMMON_SUCCESS.getCode());commonResult.setMessage(StatusCode.COMMON_SUCCESS.getMessage());commonResult.setData(user);return commonResult;}}
六、底部获取项目源码和万字论文参考(9.9¥带走)
有问题,或者需要协助调试运行项目的也可以