首页>代码>基于SSM的酒店管理系统的设计与实现(分前后台)>/hotel-management-system/src/main/java/cn/edu/glut/jiudian/controller/OrderController.java
package cn.edu.glut.jiudian.controller; import cn.edu.glut.jiudian.entity.Order; import cn.edu.glut.jiudian.entity.Room; import cn.edu.glut.jiudian.service.OrderService; import cn.edu.glut.jiudian.service.RoomService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.servlet.ModelAndView; import java.util.HashMap; import java.util.List; /** * @author stone(huangshizhang) at 2019-06-13 19:55 */ @Controller public class OrderController { @Autowired private OrderService orderService; @Autowired private RoomService roomService; private Order checkout; @RequestMapping("ruzhu_management.html") public ModelAndView ruzhuManagement(){ List<Order> orderList = orderService.selectAll(); ModelAndView mav = new ModelAndView("ruzhu_management"); mav.addObject("orderList", orderList); return mav; } @RequestMapping("addPayment") @ResponseBody public Object addPayment(Order order){ order.setEndTime(new java.sql.Date(new java.util.Date().getTime())); HashMap<String, String> res = new HashMap<>(); if (orderService.updateByRoomId(order)) { res.put("stateCode", "1"); } else { res.put("stateCode", "0"); } return res; } @RequestMapping("checkout") @ResponseBody public Object checkout(@RequestParam("roomId") String roomId){ checkout = orderService.selectByRoomId(roomId); return true; } @RequestMapping("ruzhu_checkout.html") public ModelAndView ruzhuCheckout(){ ModelAndView mav = new ModelAndView("ruzhu_checkout"); mav.addObject("checkout", checkout); return mav; } @RequestMapping("ruzhu_add.html") public ModelAndView ruzhuAdd(){ List<Room> roomList = roomService.selectNotInRuZhu(); ModelAndView mav = new ModelAndView("ruzhu_add"); mav.addObject("roomList", roomList); return mav; } @RequestMapping("addRuZhu") @ResponseBody public Object addRuZhu(Order order){ order.setStartTime(new java.sql.Date(new java.util.Date().getTime())); HashMap<String, String> res = new HashMap<>(); if (orderService.addOrder(order)) { res.put("stateCode", "1"); } else { res.put("stateCode", "0"); } return res; } @RequestMapping("deleteRuZhu") @ResponseBody public Object deleteRuZhu(@RequestParam("roomId") String roomId){ HashMap<String, String> res = new HashMap<>(); if (orderService.deleteByRoomId(roomId)) { res.put("stateCode", "1"); } else { res.put("stateCode", "0"); } return res; } }

唐唐丶 LV34
2月17日
_nrxsh LV12
2024年7月3日
樱花味小然子 LV5
2024年6月21日
ewan007 LV30
2024年5月21日
wanglinddad LV55
2024年5月10日
Boss绝 LV9
2024年4月16日
mzqnxyh LV2
2024年4月12日
wbw123 LV5
2024年4月2日
微信网友_6927932988952576 LV12
2024年3月30日
qiang123 LV8
2024年3月2日

zq1685 LV4
前天
武诗雨 LV1
6月4日
Anonly LV2
5月26日
gggggg343434 LV1
5月24日
SX520886 LV6
4月24日
shuaiqi
4月22日
暂无贡献等级
luhong LV4
3月31日
漫步的南瓜 LV1
3月28日
微信网友_7442145205784576
3月27日
暂无贡献等级
docnnxxy688
3月22日
暂无贡献等级