コード例 #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 void prepare() throws Exception {
   if (isNullOrEmptyString(id)) {
     klShoppingCarthistory = new KlShoppingCarthistory();
   } else {
     klShoppingCarthistory = (KlShoppingCarthistory) klShoppingCarthistoryManager.getById(id);
   }
 }
コード例 #3
0
 public String listAjax() {
   KlShoppingCarthistoryQuery query =
       newQuery(KlShoppingCarthistoryQuery.class, DEFAULT_SORT_COLUMNS);
   String sort = this.getRequest().getParameter("sort");
   if (StringUtils.isNotEmpty(sort)) query.setSortColumns(sort);
   Page page = klShoppingCarthistoryManager.findPage(query);
   Map map = new HashMap();
   map.put("total", page.getTotalCount());
   map.put("rows", page.getResult());
   return writeAjaxResponse(Json.toJson(map));
 }
コード例 #4
0
 /** 执行搜索 */
 public String list() {
   KlShoppingCarthistoryQuery query =
       newQuery(KlShoppingCarthistoryQuery.class, DEFAULT_SORT_COLUMNS);
   String sort = this.getRequest().getParameter("sort");
   if (StringUtils.isNotEmpty(sort)) query.setSortColumns(sort);
   Page page = klShoppingCarthistoryManager.findPage(query);
   if ("ajax".equalsIgnoreCase(Utils.getParam(getRequest(), "ajax"))) {
     Map map = new HashMap();
     map.put("pg", page);
     return writeAjaxResponse(Json.toJson(map));
   } else {
     this.getRequest().setAttribute("pg", page);
     return LIST_JSP;
   }
 }
コード例 #5
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;
    }
  }