Пример #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
 /**
  * 增加关键字
  *
  * @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";
 }