This repository has been archived on 2025-01-14. You can view files and clone it, but cannot push or open issues/pull-requests.
2024-12-21 14:30:26 +08:00
|
|
|
package example.controller;
|
|
|
|
|
|
|
|
import example.service.IOrdersService;
|
|
|
|
import example.service.impl.OrdersServiceImpl;
|
|
|
|
|
|
|
|
import javax.servlet.ServletException;
|
|
|
|
import javax.servlet.annotation.WebServlet;
|
|
|
|
import javax.servlet.http.HttpServlet;
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
import java.io.IOException;
|
|
|
|
|
|
|
|
@WebServlet("/orders")
|
|
|
|
public class OrdersServlet extends HttpServlet {
|
|
|
|
|
|
|
|
IOrdersService ordersService=new OrdersServiceImpl();
|
|
|
|
|
|
|
|
@Override
|
|
|
|
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
|
|
|
|
String action = req.getParameter("action");
|
|
|
|
switch (action) {
|
|
|
|
case "all":
|
|
|
|
ordersService.allOrder(req, resp);
|
|
|
|
break;
|
2024-12-21 16:41:21 +08:00
|
|
|
case "add":
|
|
|
|
try {
|
|
|
|
ordersService.checkOrder(req, resp);
|
|
|
|
} catch (Exception e) {
|
|
|
|
throw new RuntimeException(e);
|
|
|
|
}
|
|
|
|
break;
|
2024-12-21 14:30:26 +08:00
|
|
|
case "delete":
|
|
|
|
// ordersService.delete(req, resp);
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|