Beispiel #1
0
  // 根据ID查找单个产品
  public String findById() {
    setMessage(null);
    setTitle("查看商品信息");
    try {
      long id = getParameterLong("id");
      product = productManager.findById(id);

      if (product == null) {
        throw new Exception();
      }
    } catch (Exception e) {
      setMessage("此商品信息不存在");
    }

    return SUCCESS;
  }
Beispiel #2
0
  // 审批单个商品
  public String auditById() {
    setTitle("商品审批结果");
    setMessage(null);
    try {
      long id = Long.parseLong(getParameter("id"));
      Product p = productManager.findById(id);
      if (p == null) {
        throw new Exception();
      }
      p.setAudited(true);
      productManager.update(p);
      setMessage("编号为" + id + ",名为 " + p.getName() + " 的商品审批成功");
    } catch (Exception e) {
      setMessage("此商品信息不存在");
    }

    return SUCCESS;
  }