mirror of
https://github.com/FreeeBird/hotel.git
synced 2025-05-06 19:49:26 +08:00
更新部分接口
This commit is contained in:
parent
f88d6c6f06
commit
6d322f19f3
@ -10,19 +10,12 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
|||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping(value = "/admin/checkIn")
|
@RequestMapping(value = "/op/check-in")
|
||||||
public class CheckInController {
|
public class CheckInController {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private CheckInService checkInService;
|
private CheckInService checkInService;
|
||||||
|
|
||||||
/**
|
|
||||||
* 入住登记
|
|
||||||
* @param peoCount
|
|
||||||
* @param persons
|
|
||||||
* @param ids
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@RequestMapping(value = "/in")
|
@RequestMapping(value = "/in")
|
||||||
public AjaxResult addCheckIn(int orderId, int peoCount, String persons, String ids){
|
public AjaxResult addCheckIn(int orderId, int peoCount, String persons, String ids){
|
||||||
CheckIn checkIn = new CheckIn();
|
CheckIn checkIn = new CheckIn();
|
||||||
@ -33,12 +26,6 @@ public class CheckInController {
|
|||||||
return ResponseTool.success(checkInService.checkIn(checkIn));
|
return ResponseTool.success(checkInService.checkIn(checkIn));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 退房登记
|
|
||||||
*
|
|
||||||
* @param roomNumber
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@RequestMapping(value = "/out")
|
@RequestMapping(value = "/out")
|
||||||
public AjaxResult checkOut(String roomNumber) {
|
public AjaxResult checkOut(String roomNumber) {
|
||||||
if(checkInService.checkOut(roomNumber)<0)
|
if(checkInService.checkOut(roomNumber)<0)
|
||||||
|
@ -9,7 +9,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
|||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping(value = "/admin/hotel")
|
@RequestMapping(value = "/op/hotel")
|
||||||
public class HotelInfoController {
|
public class HotelInfoController {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
|
@ -6,6 +6,7 @@ import cn.mafangui.hotel.response.MsgType;
|
|||||||
import cn.mafangui.hotel.response.ResponseTool;
|
import cn.mafangui.hotel.response.ResponseTool;
|
||||||
import cn.mafangui.hotel.service.UserService;
|
import cn.mafangui.hotel.service.UserService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMethod;
|
import org.springframework.web.bind.annotation.RequestMethod;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
@ -14,45 +15,30 @@ import javax.servlet.http.HttpServletRequest;
|
|||||||
import javax.servlet.http.HttpSession;
|
import javax.servlet.http.HttpSession;
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping(value = "/worker/user")
|
@RequestMapping(value = "/op/user")
|
||||||
public class WorkerUserController {
|
public class OpUserController {
|
||||||
@Autowired
|
@Autowired
|
||||||
private UserService userService;
|
private UserService userService;
|
||||||
|
|
||||||
|
|
||||||
|
@RequestMapping(value = "")
|
||||||
|
public AjaxResult getAllUser(){
|
||||||
|
return ResponseTool.success(userService.selectAllUser());
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequestMapping(value = "/count")
|
||||||
|
public AjaxResult getUserCount(){
|
||||||
|
return ResponseTool.success(userService.getUserCount());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 用户添加
|
|
||||||
* @param username
|
|
||||||
* @param password
|
|
||||||
* @param name
|
|
||||||
* @param gender
|
|
||||||
* @param phone
|
|
||||||
* @param email
|
|
||||||
* @param address
|
|
||||||
* @param idcard
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@RequestMapping(method = RequestMethod.POST,value = "/add")
|
@RequestMapping(method = RequestMethod.POST,value = "/add")
|
||||||
public int userAdd(String username,String password,String name,String gender,String phone,String email,String address,String idcard){
|
public int userAdd(String username,String password,String name,String gender,String phone,String email,String address,String idcard){
|
||||||
User user = new User(username,password,name,gender,phone,email,address,idcard);
|
User user = new User(username,password,name,gender,phone,email,address,idcard);
|
||||||
return userService.addUser(user);
|
return userService.addUser(user);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 更新用户信息
|
|
||||||
* @param userId
|
|
||||||
* @param name
|
|
||||||
* @param gender
|
|
||||||
* @param phone
|
|
||||||
* @param email
|
|
||||||
* @param address
|
|
||||||
* @param idcard
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@RequestMapping(method = RequestMethod.POST,value = "/update")
|
@RequestMapping(method = RequestMethod.POST,value = "/update")
|
||||||
public AjaxResult userUpdate(int userId, String name, String gender, String phone,
|
public AjaxResult userUpdate(Integer userId, String name, String gender, String phone,
|
||||||
String email, String address, String idcard, HttpServletRequest request){
|
String email, String address, String idcard, HttpServletRequest request){
|
||||||
HttpSession session = request.getSession();
|
HttpSession session = request.getSession();
|
||||||
if (!session.getAttribute("userId").equals(userId)){
|
if (!session.getAttribute("userId").equals(userId)){
|
||||||
@ -71,13 +57,7 @@ public class WorkerUserController {
|
|||||||
return ResponseTool.success("修改失败,请检查或稍后再试");
|
return ResponseTool.success("修改失败,请检查或稍后再试");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 更改密码
|
|
||||||
* @param username
|
|
||||||
* @param oldPassword
|
|
||||||
* @param newPassword
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@RequestMapping(method = RequestMethod.POST,value = "/updatePassword")
|
@RequestMapping(method = RequestMethod.POST,value = "/updatePassword")
|
||||||
public AjaxResult updatePassword(String username,String oldPassword,String newPassword){
|
public AjaxResult updatePassword(String username,String oldPassword,String newPassword){
|
||||||
User user = userService.selectByUsernameAndPassword(username,oldPassword);
|
User user = userService.selectByUsernameAndPassword(username,oldPassword);
|
||||||
@ -90,51 +70,23 @@ public class WorkerUserController {
|
|||||||
return ResponseTool.failed("修改失败");
|
return ResponseTool.failed("修改失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取个人资料
|
@RequestMapping(value = "/{userId}")
|
||||||
* @param request
|
public AjaxResult getProfile(@PathVariable Integer userId){
|
||||||
* @return
|
User user = userService.selectById(userId);
|
||||||
*/
|
|
||||||
@RequestMapping(value = "/profile")
|
|
||||||
public AjaxResult getProfile(HttpServletRequest request){
|
|
||||||
String username = (String) request.getSession().getAttribute("username");
|
|
||||||
User user = userService.selectByUsername(username);
|
|
||||||
if(user==null) return ResponseTool.failed("未知错误");
|
|
||||||
user.setPassword(null);
|
user.setPassword(null);
|
||||||
StringBuilder sb = new StringBuilder(user.getIdcard());
|
|
||||||
sb.replace(5,12,"********");
|
|
||||||
user.setIdcard(sb.toString());
|
|
||||||
return ResponseTool.success(user);
|
return ResponseTool.success(user);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
@RequestMapping(value = "/username/{username}")
|
||||||
* 根据username查找用户
|
public AjaxResult getByUsername(@PathVariable String username){
|
||||||
* @param username
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@RequestMapping(value = "/withUsername")
|
|
||||||
public AjaxResult getByUsername(String username, HttpServletRequest request){
|
|
||||||
if(!request.getSession().getAttribute("username").equals(username)){
|
|
||||||
return ResponseTool.failed(MsgType.PERMISSION_DENIED);
|
|
||||||
}
|
|
||||||
User user = userService.selectByUsername(username);
|
User user = userService.selectByUsername(username);
|
||||||
user.setPassword(null);
|
user.setPassword(null);
|
||||||
return ResponseTool.success(user);
|
return ResponseTool.success(user);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 注销
|
|
||||||
* @param request
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@RequestMapping(value = "/logout",method = RequestMethod.POST)
|
|
||||||
public AjaxResult logout(HttpServletRequest request){
|
|
||||||
HttpSession session = request.getSession();
|
|
||||||
session.removeAttribute("userId");
|
|
||||||
session.removeAttribute("username");
|
|
||||||
return ResponseTool.success("注销成功");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
@ -1,12 +1,14 @@
|
|||||||
package cn.mafangui.hotel.controller;
|
package cn.mafangui.hotel.controller.worker;
|
||||||
|
|
||||||
import cn.mafangui.hotel.entity.Order;
|
import cn.mafangui.hotel.entity.Order;
|
||||||
import cn.mafangui.hotel.enums.OrderStatus;
|
import cn.mafangui.hotel.enums.OrderStatus;
|
||||||
import cn.mafangui.hotel.response.AjaxResult;
|
import cn.mafangui.hotel.response.AjaxResult;
|
||||||
|
import cn.mafangui.hotel.response.MsgType;
|
||||||
import cn.mafangui.hotel.response.ResponseTool;
|
import cn.mafangui.hotel.response.ResponseTool;
|
||||||
import cn.mafangui.hotel.service.OrderService;
|
import cn.mafangui.hotel.service.OrderService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.format.annotation.DateTimeFormat;
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMethod;
|
import org.springframework.web.bind.annotation.RequestMethod;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
@ -18,7 +20,7 @@ import java.util.List;
|
|||||||
* 订单接口
|
* 订单接口
|
||||||
*/
|
*/
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping(value = "/order")
|
@RequestMapping(value = "/op/order")
|
||||||
public class OrderController {
|
public class OrderController {
|
||||||
@Autowired
|
@Autowired
|
||||||
private OrderService orderService;
|
private OrderService orderService;
|
||||||
@ -26,68 +28,34 @@ public class OrderController {
|
|||||||
/**
|
/**
|
||||||
* 添加预订
|
* 添加预订
|
||||||
* 订单状态默认为未付款状态
|
* 订单状态默认为未付款状态
|
||||||
* @param orderTypeId
|
|
||||||
* @param orderType
|
|
||||||
* @param userId
|
|
||||||
* @param name
|
|
||||||
* @param phone
|
|
||||||
* @param roomTypeId
|
|
||||||
* @param roomType
|
|
||||||
* @param orderDate
|
|
||||||
* @param orderDays
|
|
||||||
* @param orderCost
|
|
||||||
* @return
|
|
||||||
*/
|
*/
|
||||||
@RequestMapping(value = "/add")
|
@RequestMapping(value = "/add")
|
||||||
public int addOrder(int orderTypeId,String orderType, int userId,String name, String phone,int roomTypeId, String roomType,
|
public AjaxResult addOrder(int orderTypeId,String orderType, int userId,String name, String phone,int roomTypeId, String roomType,
|
||||||
@DateTimeFormat(pattern = "yyyy-MM-dd") Date orderDate, Integer orderDays, Double orderCost){
|
@DateTimeFormat(pattern = "yyyy-MM-dd") Date orderDate, Integer orderDays, Double orderCost){
|
||||||
Order order = new Order(orderTypeId,orderType,userId,name,phone,roomTypeId,
|
Order order = new Order(orderTypeId,orderType,userId,name,phone,roomTypeId,
|
||||||
roomType,orderDate,orderDays, OrderStatus.UNPAID.getCode(),orderCost);
|
roomType,orderDate,orderDays, OrderStatus.UNPAID.getCode(),orderCost);
|
||||||
return orderService.addOrder(order);
|
int re = orderService.addOrder(order);
|
||||||
|
if(re!=1) return ResponseTool.failed(MsgType.FAILED);
|
||||||
|
return ResponseTool.success("添加成功.");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除订单
|
|
||||||
* @param orderId
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@RequestMapping(value = "/delete")
|
@RequestMapping(value = "/delete")
|
||||||
public int deleteOrder(int orderId){
|
public AjaxResult deleteOrder(int orderId){
|
||||||
return orderService.delete(orderId);
|
int re = orderService.delete(orderId);
|
||||||
|
if(re!=1) return ResponseTool.failed(MsgType.FAILED);
|
||||||
|
return ResponseTool.success("删除成功.");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 客户删除订单
|
|
||||||
* @param orderId
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@RequestMapping(value = "/deleteByUser")
|
|
||||||
public int deleteOrderByUser(int orderId){
|
|
||||||
Order order = new Order(orderId,OrderStatus.WAS_DELETED.getCode());
|
|
||||||
return orderService.update(order);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 修改订单
|
|
||||||
* @param orderId
|
|
||||||
* @param orderTypeId
|
|
||||||
* @param orderType
|
|
||||||
* @param userId
|
|
||||||
* @param name
|
|
||||||
* @param phone
|
|
||||||
* @param roomTypeId
|
|
||||||
* @param roomType
|
|
||||||
* @param orderDate
|
|
||||||
* @param orderDays
|
|
||||||
* @param orderCost
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@RequestMapping(value = "/update")
|
@RequestMapping(value = "/update")
|
||||||
public int updateOrder(int orderId,int orderTypeId,String orderType, int userId,String name, String phone,int roomTypeId, String roomType,
|
public AjaxResult updateOrder(int orderId,int orderTypeId,String orderType, int userId,String name, String phone,int roomTypeId, String roomType,
|
||||||
@DateTimeFormat(pattern = "yyyy-MM-dd") Date orderDate, Integer orderDays, Double orderCost){
|
@DateTimeFormat(pattern = "yyyy-MM-dd") Date orderDate, Integer orderDays, Double orderCost){
|
||||||
Order order = new Order(orderTypeId,orderType,userId,name,phone,roomTypeId,
|
Order order = new Order(orderTypeId,orderType,userId,name,phone,roomTypeId,
|
||||||
roomType,orderDate,orderDays, OrderStatus.UNPAID.getCode(),orderCost);
|
roomType,orderDate,orderDays, OrderStatus.UNPAID.getCode(),orderCost);
|
||||||
return orderService.update(order);
|
int re = orderService.update(order);
|
||||||
|
if(re!=1) return ResponseTool.failed(MsgType.FAILED);
|
||||||
|
return ResponseTool.success("修改成功.");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -96,8 +64,10 @@ public class OrderController {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@RequestMapping(method = RequestMethod.POST,value = "/pay")
|
@RequestMapping(method = RequestMethod.POST,value = "/pay")
|
||||||
public int payOrder(int orderId){
|
public AjaxResult payOrder(int orderId){
|
||||||
return orderService.payOrder(orderId);
|
int re = orderService.payOrder(orderId);
|
||||||
|
if(re!=1) return ResponseTool.failed(MsgType.FAILED);
|
||||||
|
return ResponseTool.success("支付成功.");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -106,8 +76,10 @@ public class OrderController {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@RequestMapping(value = "/cancel")
|
@RequestMapping(value = "/cancel")
|
||||||
public int cancelOrder(int orderId){
|
public AjaxResult cancelOrder(int orderId){
|
||||||
return orderService.cancelOrder(orderId);
|
int re= orderService.cancelOrder(orderId);
|
||||||
|
if(re!=1) return ResponseTool.failed(MsgType.FAILED);
|
||||||
|
return ResponseTool.success("取消成功.");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -122,13 +94,14 @@ public class OrderController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
@RequestMapping(value = "")
|
||||||
* 所有订单
|
public AjaxResult getAllOrder(){
|
||||||
* @return
|
return ResponseTool.success(orderService.AllOrders());
|
||||||
*/
|
}
|
||||||
@RequestMapping(value = "/all")
|
|
||||||
public List<Order> getAllOrder(){
|
@RequestMapping(value = "/count")
|
||||||
return orderService.AllOrders();
|
public AjaxResult getOrderCount(){
|
||||||
|
return ResponseTool.success(orderService.getOrderCount());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -136,29 +109,20 @@ public class OrderController {
|
|||||||
* @param userId
|
* @param userId
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@RequestMapping(value = "/withUserId")
|
@RequestMapping(value = "/user/{userId}")
|
||||||
public List<Order> getByUser(int userId){
|
public AjaxResult getByUser(@PathVariable int userId){
|
||||||
return orderService.selectByUserId(userId);
|
return ResponseTool.success(orderService.selectByUserId(userId));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 客户查询个人所有订单(不包括被自己删除的)
|
|
||||||
* @param userId
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@RequestMapping(value = "/userOrder")
|
|
||||||
public AjaxResult getAllByUser(int userId){
|
|
||||||
return ResponseTool.success(orderService.UsersAllOrders(userId));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据订单号查询订单
|
* 根据订单号查询订单
|
||||||
* @param orderId
|
* @param orderId
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@RequestMapping(value = "/withId")
|
@RequestMapping(value = "/{orderId}")
|
||||||
public Order getById(int orderId){
|
public AjaxResult getById(@PathVariable Integer orderId){
|
||||||
return orderService.selectById(orderId);
|
return ResponseTool.success(orderService.selectById(orderId));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -169,7 +133,8 @@ public class OrderController {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@RequestMapping(value = "/withNameAndPhone")
|
@RequestMapping(value = "/withNameAndPhone")
|
||||||
public Order getByNameAndPhone(String name,String phone){
|
public AjaxResult getByNameAndPhone(String name,String phone){
|
||||||
return orderService.selectByNameAndPhone(name,phone);
|
return ResponseTool.success(orderService.selectByNameAndPhone(name,phone));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -1,15 +1,18 @@
|
|||||||
package cn.mafangui.hotel.controller.worker;
|
package cn.mafangui.hotel.controller.worker;
|
||||||
|
|
||||||
import cn.mafangui.hotel.entity.OrderType;
|
import cn.mafangui.hotel.entity.OrderType;
|
||||||
|
import cn.mafangui.hotel.response.AjaxResult;
|
||||||
|
import cn.mafangui.hotel.response.ResponseTool;
|
||||||
import cn.mafangui.hotel.service.OrderTypeService;
|
import cn.mafangui.hotel.service.OrderTypeService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping(value = "/orderType")
|
@RequestMapping(value = "/op/order-type")
|
||||||
public class OrderTypeController {
|
public class OrderTypeController {
|
||||||
@Autowired
|
@Autowired
|
||||||
private OrderTypeService orderTypeService;
|
private OrderTypeService orderTypeService;
|
||||||
@ -21,25 +24,25 @@ public class OrderTypeController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping(value = "/delete")
|
@RequestMapping(value = "/delete")
|
||||||
public int deleteOrderType(int typeId){
|
public int deleteOrderType(Integer typeId){
|
||||||
return orderTypeService.deleteOrderType(typeId);
|
return orderTypeService.deleteOrderType(typeId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping(value = "/update")
|
@RequestMapping(value = "/update")
|
||||||
public int updateOrderType(int typeId,String type,String remark){
|
public int updateOrderType(Integer typeId,String type,String remark){
|
||||||
OrderType orderType = new OrderType(type,remark);
|
OrderType orderType = new OrderType(type,remark);
|
||||||
orderType.setTypeId(typeId);
|
orderType.setTypeId(typeId);
|
||||||
return orderTypeService.updateOrderType(orderType);
|
return orderTypeService.updateOrderType(orderType);
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping(value = "/withId")
|
@RequestMapping(value = "/{typeId}")
|
||||||
public OrderType getById(int typeId){
|
public AjaxResult getById(@PathVariable Integer typeId){
|
||||||
return orderTypeService.selectById(typeId);
|
return ResponseTool.success(orderTypeService.selectById(typeId));
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping(value = "all")
|
@RequestMapping(value = "")
|
||||||
public List<OrderType> getAllType(){
|
public AjaxResult getAllType(){
|
||||||
return orderTypeService.selectAll();
|
return ResponseTool.success(orderTypeService.selectAll());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
|||||||
import org.springframework.web.bind.annotation.RequestMethod;
|
import org.springframework.web.bind.annotation.RequestMethod;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping(value = "/admin/room")
|
@RequestMapping(value = "/op/room")
|
||||||
public class RoomController {
|
public class RoomController {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
|
@ -7,6 +7,7 @@ import java.util.List;
|
|||||||
|
|
||||||
@Component
|
@Component
|
||||||
public interface CheckInMapper {
|
public interface CheckInMapper {
|
||||||
|
Integer getCount();
|
||||||
int deleteByPrimaryKey(Integer checkInId);
|
int deleteByPrimaryKey(Integer checkInId);
|
||||||
|
|
||||||
int insert(CheckIn record);
|
int insert(CheckIn record);
|
||||||
|
@ -8,6 +8,7 @@ import java.util.List;
|
|||||||
|
|
||||||
@Component
|
@Component
|
||||||
public interface OrderMapper {
|
public interface OrderMapper {
|
||||||
|
|
||||||
int deleteByPrimaryKey(Integer orderId);
|
int deleteByPrimaryKey(Integer orderId);
|
||||||
|
|
||||||
int insert(Order record);
|
int insert(Order record);
|
||||||
@ -22,6 +23,8 @@ public interface OrderMapper {
|
|||||||
|
|
||||||
int updateByPrimaryKey(Order record);
|
int updateByPrimaryKey(Order record);
|
||||||
|
|
||||||
|
Integer getOrderCount();
|
||||||
|
|
||||||
List<Order> selectAll();
|
List<Order> selectAll();
|
||||||
|
|
||||||
List<Order> selectByUserId(Integer userId);
|
List<Order> selectByUserId(Integer userId);
|
||||||
|
@ -8,6 +8,7 @@ import java.util.List;
|
|||||||
|
|
||||||
@Component
|
@Component
|
||||||
public interface OrderTypeMapper {
|
public interface OrderTypeMapper {
|
||||||
|
Integer getCount();
|
||||||
int deleteByPrimaryKey(Integer typeId);
|
int deleteByPrimaryKey(Integer typeId);
|
||||||
|
|
||||||
int insert(OrderType record);
|
int insert(OrderType record);
|
||||||
|
@ -7,6 +7,7 @@ import org.springframework.stereotype.Component;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
@Component
|
@Component
|
||||||
public interface RoomMapper {
|
public interface RoomMapper {
|
||||||
|
Integer getCount();
|
||||||
int deleteByPrimaryKey(Integer roomId);
|
int deleteByPrimaryKey(Integer roomId);
|
||||||
|
|
||||||
int insert(Room record);
|
int insert(Room record);
|
||||||
|
@ -7,6 +7,7 @@ import java.util.List;
|
|||||||
|
|
||||||
@Component
|
@Component
|
||||||
public interface RoomTypeMapper {
|
public interface RoomTypeMapper {
|
||||||
|
Integer getCount();
|
||||||
int deleteByPrimaryKey(Integer typeId);
|
int deleteByPrimaryKey(Integer typeId);
|
||||||
|
|
||||||
int insert(RoomType record);
|
int insert(RoomType record);
|
||||||
|
@ -20,6 +20,8 @@ public interface UserMapper {
|
|||||||
|
|
||||||
int updateByPrimaryKey(User record);
|
int updateByPrimaryKey(User record);
|
||||||
|
|
||||||
|
Integer getUserCount();
|
||||||
|
|
||||||
User selectByUsernameAndPassword(@Param("username") String username,@Param("password") String password);
|
User selectByUsernameAndPassword(@Param("username") String username,@Param("password") String password);
|
||||||
|
|
||||||
User selectByUsername(String username);
|
User selectByUsername(String username);
|
||||||
|
@ -8,6 +8,7 @@ import java.util.List;
|
|||||||
|
|
||||||
@Component
|
@Component
|
||||||
public interface WorkerMapper {
|
public interface WorkerMapper {
|
||||||
|
Integer getCount();
|
||||||
int deleteByPrimaryKey(Integer workerId);
|
int deleteByPrimaryKey(Integer workerId);
|
||||||
|
|
||||||
int insert(Worker record);
|
int insert(Worker record);
|
||||||
|
@ -22,6 +22,8 @@ public interface OrderService {
|
|||||||
|
|
||||||
int cancelOrder(int orderId);
|
int cancelOrder(int orderId);
|
||||||
|
|
||||||
|
Integer getOrderCount();
|
||||||
|
|
||||||
List<Order> selectByUserId(int userId);
|
List<Order> selectByUserId(int userId);
|
||||||
|
|
||||||
List<Order> AllOrders();
|
List<Order> AllOrders();
|
||||||
|
@ -17,6 +17,8 @@ public interface UserService {
|
|||||||
|
|
||||||
int updateUser(User user);
|
int updateUser(User user);
|
||||||
|
|
||||||
|
Integer getUserCount();
|
||||||
|
|
||||||
User selectByUsernameAndPassword(String username, String password);
|
User selectByUsernameAndPassword(String username, String password);
|
||||||
|
|
||||||
User selectByUsername(String username);
|
User selectByUsername(String username);
|
||||||
|
@ -106,6 +106,11 @@ public class OrderServiceImpl implements OrderService {
|
|||||||
return orderMapper.updateByPrimaryKeySelective(order);
|
return orderMapper.updateByPrimaryKeySelective(order);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Integer getOrderCount() {
|
||||||
|
return orderMapper.getOrderCount();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Order> selectByUserId(int userId) {
|
public List<Order> selectByUserId(int userId) {
|
||||||
return orderMapper.selectByUserId(userId);
|
return orderMapper.selectByUserId(userId);
|
||||||
|
@ -41,6 +41,11 @@ public class UserServiceImpl implements UserService {
|
|||||||
return userMapper.updateByPrimaryKeySelective(user);
|
return userMapper.updateByPrimaryKeySelective(user);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Integer getUserCount() {
|
||||||
|
return userMapper.getUserCount();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public User selectByUsernameAndPassword(String username, String password) {
|
public User selectByUsernameAndPassword(String username, String password) {
|
||||||
String pass = MD5Utils.MD5Encode(password);
|
String pass = MD5Utils.MD5Encode(password);
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package cn.mafangui.hotel.tool;
|
package cn.mafangui.hotel.tool;
|
||||||
|
|
||||||
import cn.mafangui.hotel.response.AjaxResult;
|
import cn.mafangui.hotel.response.AjaxResult;
|
||||||
|
import cn.mafangui.hotel.response.MsgType;
|
||||||
import cn.mafangui.hotel.response.ResponseTool;
|
import cn.mafangui.hotel.response.ResponseTool;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import org.springframework.web.servlet.HandlerInterceptor;
|
import org.springframework.web.servlet.HandlerInterceptor;
|
||||||
@ -21,7 +22,7 @@ public class SessionInterceptor implements HandlerInterceptor {
|
|||||||
}else {
|
}else {
|
||||||
setCorsMappings(request, response);
|
setCorsMappings(request, response);
|
||||||
PrintWriter writer = response.getWriter();
|
PrintWriter writer = response.getWriter();
|
||||||
AjaxResult result = ResponseTool.failed("Not Login");
|
AjaxResult result = ResponseTool.failed("NOT LOGIN");
|
||||||
ObjectMapper mapper = new ObjectMapper();
|
ObjectMapper mapper = new ObjectMapper();
|
||||||
writer.write(mapper.writeValueAsString(result));
|
writer.write(mapper.writeValueAsString(result));
|
||||||
return false;
|
return false;
|
||||||
|
@ -17,6 +17,9 @@
|
|||||||
check_in_id, order_id, room_number,peo_count, persons, ids, check_in_time, check_out_time,
|
check_in_id, order_id, room_number,peo_count, persons, ids, check_in_time, check_out_time,
|
||||||
create_time, update_time
|
create_time, update_time
|
||||||
</sql>
|
</sql>
|
||||||
|
<select id="getCount" resultType="java.lang.Integer">
|
||||||
|
select count(check_in_id) from check_in
|
||||||
|
</select>
|
||||||
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
|
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
|
||||||
select
|
select
|
||||||
<include refid="Base_Column_List" />
|
<include refid="Base_Column_List" />
|
||||||
|
@ -32,6 +32,10 @@
|
|||||||
<include refid="Base_Column_List" />
|
<include refid="Base_Column_List" />
|
||||||
from order_info
|
from order_info
|
||||||
</select>
|
</select>
|
||||||
|
<select id="getOrderCount" resultType="java.lang.Integer">
|
||||||
|
select count(order_id)
|
||||||
|
from order_info
|
||||||
|
</select>
|
||||||
<select id="selectByNameAndPhone" parameterType="cn.mafangui.hotel.entity.Order" resultMap="BaseResultMap">
|
<select id="selectByNameAndPhone" parameterType="cn.mafangui.hotel.entity.Order" resultMap="BaseResultMap">
|
||||||
select
|
select
|
||||||
<include refid="Base_Column_List" />
|
<include refid="Base_Column_List" />
|
||||||
|
@ -11,6 +11,9 @@
|
|||||||
<sql id="Base_Column_List">
|
<sql id="Base_Column_List">
|
||||||
type_id, type, remark, create_time, update_time
|
type_id, type, remark, create_time, update_time
|
||||||
</sql>
|
</sql>
|
||||||
|
<select id="getCount" resultType="java.lang.Integer">
|
||||||
|
select count(type_id) from order_type
|
||||||
|
</select>
|
||||||
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
|
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
|
||||||
select
|
select
|
||||||
<include refid="Base_Column_List" />
|
<include refid="Base_Column_List" />
|
||||||
|
@ -17,6 +17,9 @@
|
|||||||
room_id, room_number, type_id, room_type, room_price, room_discount, room_status,
|
room_id, room_number, type_id, room_type, room_price, room_discount, room_status,
|
||||||
remark, create_time, update_time
|
remark, create_time, update_time
|
||||||
</sql>
|
</sql>
|
||||||
|
<select id="getCount" resultType="java.lang.Integer">
|
||||||
|
select count(room_id) from room_info
|
||||||
|
</select>
|
||||||
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
|
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
|
||||||
select
|
select
|
||||||
<include refid="Base_Column_List" />
|
<include refid="Base_Column_List" />
|
||||||
|
@ -19,6 +19,9 @@
|
|||||||
type_id, room_type, remark, price, discount, area, bed_num, bed_size, window, rest,create_time,
|
type_id, room_type, remark, price, discount, area, bed_num, bed_size, window, rest,create_time,
|
||||||
update_time
|
update_time
|
||||||
</sql>
|
</sql>
|
||||||
|
<select id="getCount" resultType="java.lang.Integer">
|
||||||
|
select count(type_id) from room_type
|
||||||
|
</select>
|
||||||
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
|
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
|
||||||
select
|
select
|
||||||
<include refid="Base_Column_List" />
|
<include refid="Base_Column_List" />
|
||||||
|
@ -28,6 +28,9 @@
|
|||||||
select * from user_info
|
select * from user_info
|
||||||
where username != ''
|
where username != ''
|
||||||
</select>
|
</select>
|
||||||
|
<select id="getUserCount" resultType="java.lang.Integer">
|
||||||
|
select count(user_id) from user_info
|
||||||
|
</select>
|
||||||
<select id="selectAll" resultMap="BaseResultMap">
|
<select id="selectAll" resultMap="BaseResultMap">
|
||||||
select * from user_info
|
select * from user_info
|
||||||
</select>
|
</select>
|
||||||
|
@ -18,6 +18,9 @@
|
|||||||
worker_id, role, username, password, name, gender, phone, email, address,
|
worker_id, role, username, password, name, gender, phone, email, address,
|
||||||
create_time, update_time
|
create_time, update_time
|
||||||
</sql>
|
</sql>
|
||||||
|
<select id="getCount" resultType="java.lang.Integer">
|
||||||
|
select count(worker_id) from worker_info
|
||||||
|
</select>
|
||||||
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
|
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
|
||||||
select
|
select
|
||||||
<include refid="Base_Column_List" />
|
<include refid="Base_Column_List" />
|
||||||
|
Loading…
x
Reference in New Issue
Block a user