コード例 #1
0
 public void prepare() throws Exception {
   if (isNullOrEmptyString(id)) {
     klShoppingCarthistory = new KlShoppingCarthistory();
   } else {
     klShoppingCarthistory = (KlShoppingCarthistory) klShoppingCarthistoryManager.getById(id);
   }
 }
コード例 #2
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;
    }
  }