@RequestMapping
  public ModelAndView updateTranCode(
      @RequestParam("tranNo") int tranNo, @RequestParam("tranCode") String tranCode)
      throws Exception {
    Purchase purchase = new Purchase();
    purchase.setTranNo(tranNo);
    purchase.setTranCode(tranCode);

    Map<String, Object> map = new HashMap<String, Object>();
    map.put("purchase", purchase);
    purchaseService.updateTranCode(map);

    ModelAndView mav = new ModelAndView();
    mav.setViewName("redirect:/app/purchase/getPurchaseList?menu=search");
    return mav;
  }
  @RequestMapping
  public ModelAndView updateTranCodeByProd(
      @RequestParam("prodNo") int prodNo, @RequestParam("tranCode") String tranCode)
      throws Exception {
    Purchase purchase = new Purchase();
    Product product = new Product();
    product.setProdNo(prodNo);
    purchase.setPurchaseProd(product);
    purchase.setTranCode(tranCode);

    Map<String, Object> map = new HashMap<String, Object>();
    map.put("product", purchase);
    purchaseService.updateTranCode(map);

    ModelAndView mav = new ModelAndView();
    mav.setViewName("redirect:/app/purchase/getSaleList?menu=manage");
    return mav;
  }
  @RequestMapping
  public ModelAndView addPurchase(
      @ModelAttribute("purchase") Purchase purchase,
      @RequestParam("prodNo") int prodNo,
      @RequestParam("buyerId") String buyerId)
      throws Exception {
    System.out.println(purchase);
    System.out.println(prodNo);
    Product product = new Product();
    product.setProdNo(prodNo);
    User user = new User();
    user.setUserId(buyerId);

    purchase.setPurchaseProd(product);
    purchase.setBuyer(user);
    purchase.setTranCode("1");
    purchaseService.addPurchase(purchase);

    product = productService.getProduct(prodNo);
    ModelAndView mav = new ModelAndView();
    mav.addObject("product", product);
    mav.setViewName("forward:/product/getProduct.jsp"); // ���ſϷ� ������
    return mav;
  }