コード例 #1
0
  /** 删除对象 */
  public String delete() {
    if (items != null)
      for (String ids : items) {
        String[] idArray = ids.split(",");
        for (String id : idArray) {
          if (StringUtils.isNotEmpty(id) && StringUtils.isNumeric(id)) {
            klShoppingCarthistory = klShoppingCarthistoryManager.getById(Long.parseLong(id));
            if (klShoppingCarthistory != null) {
              // klShoppingCarthistory.setStatus(-1);
              // klShoppingCarthistoryManager.update(klShoppingCarthistory);
              klShoppingCarthistoryManager.removeById(klShoppingCarthistory.getId());
            }
          }
        }
        // klShoppingCarthistoryManager.removeById(Long.parseLong(id));
      }

    if ("ajax".equalsIgnoreCase(Utils.getParam(getRequest(), "ajax"))) {
      Map map = new HashMap();
      map.put("re", 1);
      return writeAjaxResponse(Json.toJson(map));
    } else {
      return LIST_ACTION;
    }
  }
コード例 #2
0
  /** 保存更新对象 */
  public String update() {
    long theuserid = Utils.getSessionUserId(getRequest());
    if (theuserid >= 0) {
      klShoppingCarthistory.setModifyuser(theuserid);
    }
    klShoppingCarthistory.setModifytimelong(System.currentTimeMillis());

    klShoppingCarthistoryManager.update(this.klShoppingCarthistory);

    if ("ajax".equalsIgnoreCase(Utils.getParam(getRequest(), "ajax"))) {
      Map map = new HashMap();
      map.put("obj", klShoppingCarthistory);
      return writeAjaxResponse(Json.toJson(map));
    } else {
      return OK_JSP;
    }
  }