示例#1
0
  /**
   * 更新关键字(排序和前台显示有关系数字越大越靠前)
   *
   * @return
   */
  @Action(
      value = "UpdateKeywordT",
      results = {@Result(name = "json", type = "json")})
  public String UpdateKeywordT() {

    if (Validate.StrNotNull(this.getSort())) {
      if (!Validate.isINTEGER_NEGATIVE(this.getSort())) {
        ActionContext.getContext().put("errormsg", "排序编号必须是正整数");
        return "json";
      }
      if (Validate.StrNotNull(this.getKeywordname())) {
        KeywordT kt = new KeywordT();
        kt.setKeywordid(this.getKeywordid().trim());
        kt.setKeywordname(this.getKeywordname().trim());
        kt.setSort(Integer.parseInt(this.getSort().trim()));
        kt.setState(this.getState().trim());
        kt.setType(this.getType().trim());
        kt.setCreatetime(BaseTools.systemtime());
        kt.setCreatorid(BaseTools.adminCreateId());
        if (this.getKeywordTService().updateKeywordT(kt) > 0) {
          return "json";
        }
        return "json";
      } else {
        ActionContext.getContext().put("errormsg", "关键字名称必须填写");
        return "json";
      }
    }
    return "json";
  }
示例#2
0
 /**
  * 查询所有关键字json方式传输
  *
  * @return
  */
 @Action(
     value = "findAllKeywordTjson",
     results = {@Result(name = "json", type = "json")})
 public String findAllKeywordTjson() {
   this.setKeywordjson("");
   this.keyword = this.getKeywordTService().findAllKeywordTjson();
   if (this.keyword != null) {
     for (Iterator it = this.keyword.iterator(); it.hasNext(); ) {
       KeywordT k = (KeywordT) it.next();
       this.keywordjson +=
           "<option value='" + k.getKeywordid() + "'>" + k.getKeywordname() + "</option>";
     }
     this.setKeywordjson(keywordjson);
     return "json";
   }
   return "json";
 }
示例#3
0
 /**
  * 增加关键字
  *
  * @return
  */
 @Action(
     value = "addKeywordT",
     results = {@Result(name = "json", type = "json")})
 public String addKeywordT() {
   if (Validate.StrisNull(this.getKeywordname())) {
     ActionContext.getContext().put("errormsg", "关键字名称必须填写");
     return "json";
   }
   if (Validate.StrisNull(this.getState())) {
     ActionContext.getContext().put("errormsg", "关键字显示状态必须选择");
     return "json";
   }
   if (Validate.StrNotNull(this.getSort())) {
     if (!Validate.isINTEGER_NEGATIVE(this.getSort())) {
       ActionContext.getContext().put("errormsg", "排序编号必须是正整数");
       return "json";
     }
   }
   if (Validate.StrisNull(this.getType())) {
     if (this.getType().equals("0")) {
       ActionContext.getContext().put("errormsg", "关键字类型必须选择");
       return "json";
     }
   }
   KeywordT kt = new KeywordT();
   kt.setKeywordid(this.getSerial().Serialid(Serial.KEYWORD));
   kt.setKeywordname(this.getKeywordname().trim());
   kt.setSearchCount(0);
   kt.setSort(Integer.parseInt(this.getSort().trim()));
   kt.setState(this.getState());
   kt.setType(this.getType());
   kt.setCreatetime(BaseTools.systemtime());
   kt.setCreatorid(BaseTools.adminCreateId());
   if (this.getKeywordTService().addKeywordT(kt) > 0) {
     this.setSlogin(true);
     return "json";
   }
   return "json";
 }
示例#4
0
 /**
  * 查询所有关键字
  *
  * @return
  */
 @SuppressWarnings("unchecked")
 @Action(
     value = "findAllKeywordT",
     results = {@Result(name = "json", type = "json")})
 public String findAllKeywordT() {
   int currentPage = page;
   int lineSize = rp;
   List<KeywordT> kt = this.getKeywordTService().findAllKeywordT(currentPage, lineSize);
   if (kt != null) {
     total = this.getKeywordTService().countAllKeywordT();
     rows.clear();
     for (Iterator it = kt.iterator(); it.hasNext(); ) {
       KeywordT k = (KeywordT) it.next();
       if (k.getType().equals("1")) {
         k.setType("商品类型");
       }
       if (k.getType().equals("2")) {
         k.setType("文章类型");
       }
       if (k.getState().equals("1")) {
         k.setState("显示");
       }
       if (k.getState().equals("2")) {
         k.setState("隐藏");
       }
       Map cellMap = new HashMap();
       cellMap.put("id", k.getKeywordid());
       cellMap.put(
           "cell",
           new Object[] {
             k.getKeywordname(),
             k.getType(),
             k.getState(),
             k.getSort(),
             BaseTools.formateDbDate(k.getCreatetime()),
             k.getCreatorid()
           });
       rows.add(cellMap);
     }
     return "json";
   }
   this.setTotal(0);
   rows.clear();
   return "json";
 }