开发工具:idea (eclipse) 环境:jdk1.8 mysql5.7
数据库库连接工具 navcat
package priv.jesse.mall.web.user; 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.ResponseBody; import priv.jesse.mall.entity.Order; import priv.jesse.mall.entity.OrderItem; import priv.jesse.mall.entity.pojo.ResultBean; import priv.jesse.mall.service.OrderService; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.util.List; @Controller @RequestMapping("/order") public class OrderController { @Autowired private OrderService orderService; @RequestMapping("/toList.html") public String toOrderList() { return "mall/order/list"; } @RequestMapping("/list.do") @ResponseBody public ResultBean> listData(HttpServletRequest request) { List
orders = orderService.findUserOrder(request); return new ResultBean<>(orders); } @RequestMapping("/getDetail.do") @ResponseBody public ResultBean > getDetail(int orderId) { List
orderItems = orderService.findItems(orderId); return new ResultBean<>(orderItems); } @RequestMapping("/submit.do") public void submit(String name, String phone, String addr, HttpServletRequest request, HttpServletResponse response) throws Exception { orderService.submit(name, phone, addr, request, response); } @RequestMapping("pay.do") @ResponseBody public ResultBean pay(int orderId, HttpServletResponse response) throws IOException { orderService.pay(orderId); return new ResultBean<>(true); } @RequestMapping("receive.do") @ResponseBody public ResultBean receive(int orderId, HttpServletResponse response) throws IOException { orderService.receive(orderId); return new ResultBean<>(true); } }
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)