Пример #1
0
  // ajax 修改
  public String updateKbDiseaseAjax() {
    log.info(logprefix + "updateKbDiseaseAjax,id=" + kbDisease.getId());
    ReturnJson returnJson = new ReturnJson();
    try {
      if (kbDisease.getId() != null && kbDisease.getId() > 0) {
        KbDisease tempKbDisease = kbDiseaseService.selectKbDiseaseById(kbDisease.getId());

        //              选择能更改的属性,与界面一致
        tempKbDisease.setName(kbDisease.getName());
        tempKbDisease.setDescription(kbDisease.getDescription());
        tempKbDisease.setKeshiid(kbDisease.getKeshiid());

        kbDiseaseService.updateKbDisease(tempKbDisease);
        returnJson.setFlag(1);
        returnJson.setReason("修改成功");
        JSONObject jo = JSONObject.fromObject(returnJson);
        this.returnStr = jo.toString();
        // actionMsg = getText("viewKbDiseaseSuccess");
        return SUCCESS;

      } else {
        actionMsg = getText("viewKbDiseaseFail");
        log.info(logprefix + "updateKbDiseaseAjax fail");
      }

    } catch (Exception e) {
      e.printStackTrace();
      log.error("类KbDiseaseAction的方法:viewKbDisease错误" + e);
    }

    returnJson.setFlag(0);
    JSONObject jo = JSONObject.fromObject(returnJson);
    this.returnStr = jo.toString();
    return SUCCESS;
  }
Пример #2
0
  // 管理 查询
  public String manageKbDiseaseFull() {
    log.info("exec action method:manageKbDiseaseFull");

    //      分页查询
    if (pageNo <= 0) {
      pageNo = 1;
    }
    page.setTotalCount(kbDiseaseService.countKbDiseaseRow());
    if (page.getTotalpage() < pageNo) {
      pageNo = page.getTotalpage();
    }
    page.setPageNo(pageNo);

    if (page.getTotalCount() != 0) {
      kbDiseaseFullList = kbDiseaseService.selectKbDiseaseFullByConditionAndPage("", page);
    }

    kbkeshiList = kbkeshiService.selectKbkeshiByCondition("");

    System.out.println("kbkeshiList:" + kbkeshiList.size());
    if (kbkeshiList == null) {
      kbkeshiList = new ArrayList<Kbkeshi>();
    }
    if (kbDiseaseFullList == null) {
      kbDiseaseFullList = new ArrayList<KbDiseaseFull>();
    }
    //      for(int i = 0; i < computerhomeworkFullList.size(); i++){
    //      	System.out.println("id=");
    //      }
    if (callType != null && callType.equals("ajaxType")) {
      return "success2";
    } else {
      return "success1";
    }
  }
Пример #3
0
  // del entityfull Ajax
  public String deleteKbDiseaseFullAjax() {

    log.info(logprefix + "deleteComputercategoryFullAjax");

    try {
      String ids[] = kbDiseaseIdsForDel.split(";");
      for (int i = 0; i < ids.length; i++) {

        Integer tempDelId = Integer.valueOf(ids[i]);
        log.info(tempDelId);
        // 检查id
        if (tempDelId == null || tempDelId < 0) {
          returnJson.setFlag(0);
          returnJson.setReason("删除的id不规范");
          log.info("删除的id不规范");
          JSONObject jo = JSONObject.fromObject(returnJson);
          this.returnStr = jo.toString();
          return SUCCESS;
        }
        // del
        KbDisease temp = kbDiseaseService.selectKbDiseaseById(tempDelId);
        if (temp != null) {
          // 其他操作
          kbDiseaseService.deleteKbDisease(tempDelId);
        } else {
          log.info("删除的id不存在");
          returnJson.setFlag(0);
          returnJson.setReason("删除的id不存在");
          JSONObject jo = JSONObject.fromObject(returnJson);
          this.returnStr = jo.toString();
          return SUCCESS;
        }
      }
      returnJson.setFlag(1);
      returnJson.setReason("删除成功");
      JSONObject jo = JSONObject.fromObject(returnJson);
      this.returnStr = jo.toString();
      return SUCCESS;

    } catch (Exception e) {
      e.printStackTrace();
    }

    returnJson.setFlag(0);
    returnJson.setReason("删除的内部错误");
    JSONObject jo = JSONObject.fromObject(returnJson);
    this.returnStr = jo.toString();
    return SUCCESS;
  }
Пример #4
0
  /**
   * view KbDiseaseFull need give parmeter id get id from modle,
   *
   * @return
   */
  public String viewKbDiseaseFull() {

    try {
      int getId = kbDisease.getId();
      log.info(this.logprefix + ";id=" + getId);

      if (getId < 0) {
        log.error("error,id小于0不规范");
        return "error";
      }

      KbDiseaseFull temKbDiseaseFull = kbDiseaseService.selectKbDiseaseFullById(getId);
      if (temKbDiseaseFull != null) {
        BeanUtils.copyProperties(kbDiseaseFull, temKbDiseaseFull);
        return SUCCESS;
      } else {
        log.error("error,查询实体不存在。");
        return "Error";
      }

    } catch (IllegalAccessException e) {
      e.printStackTrace();
    } catch (InvocationTargetException e) {
      e.printStackTrace();
    } catch (Exception e) {
      e.printStackTrace();
    }
    return "Error";
  }
Пример #5
0
  /** 编辑实体Full action的方法,首先获取entityfull的信息,返回到编辑页面 */
  public String editKbDiseaseFull() {

    log.info(logprefix + "viewKbDisease");

    try {
      if (kbDisease.getId() != null && kbDisease.getId() > 0) {
        KbDiseaseFull temKbDiseaseFull =
            kbDiseaseService.selectKbDiseaseFullById(kbDisease.getId());
        BeanUtils.copyProperties(kbDiseaseFull, temKbDiseaseFull);
        actionMsg = getText("selectKbDiseaseByIdSuccess");
      } else {
        actionMsg = getText("selectKbDiseaseByIdFail");
        System.out.println(actionMsg);
      }
      return SUCCESS;
    } catch (IllegalAccessException e) {
      e.printStackTrace();
    } catch (InvocationTargetException e) {
      e.printStackTrace();
    } catch (Exception e) {
      e.printStackTrace();
      log.error("类KbDiseaseAction的方法:selectKbDiseaseFullById错误" + e);
    }

    return "error";
  }
Пример #6
0
  /** 编辑实体 action的方法,首先获取entity的信息,返回到编辑页面 */
  public String editKbDisease() {
    log.info(logprefix + "editKbDisease");

    try {
      // 实体的id可以为0
      if (kbDisease.getId() != null && kbDisease.getId() >= 0) {
        KbDisease temKbDisease = kbDiseaseService.selectKbDiseaseById(kbDisease.getId());
        if (temKbDisease != null) {
          BeanUtils.copyProperties(kbDiseaseModel, temKbDisease);
          // actionMsg = getText("selectKbDiseaseByIdSuccess");
          return SUCCESS;
        }
      }
      return "PageNotExist";
    } catch (IllegalAccessException e) {
      e.printStackTrace();
    } catch (InvocationTargetException e) {
      e.printStackTrace();
    } catch (Exception e) {
      e.printStackTrace();
      log.error("类KbDiseaseAction的方法:selectKbDiseaseById错误" + e);
    }

    return "error";
  }
Пример #7
0
  //  ajax add
  public String addKbDiseaseAjax() {
    log.info("Add Entity Ajax Manner");

    ReturnJson returnJson = new ReturnJson();

    try {
      KbDisease temp = new KbDisease();
      // 将model里的属性值赋给temp
      BeanUtils.copyProperties(temp, kbDisease);
      // add your code here.

      // temp.setCreatetime(DateUtil.currentDate());

      kbDiseaseService.addKbDisease(temp);

      returnJson.setFlag(1);
      returnJson.setReason("添加成功");
      JSONObject jo = JSONObject.fromObject(returnJson);
      this.returnStr = jo.toString();

      return SUCCESS;
    } catch (IllegalAccessException e) {
      e.printStackTrace();
    } catch (InvocationTargetException e) {
      e.printStackTrace();
    } catch (Exception e) {
      e.printStackTrace();
      log.error("类KbDiseaseAction的方法:addBbstagfavourite错误" + e);
    }

    returnJson.setFlag(0);
    returnJson.setReason("添加失败");
    JSONObject jo = JSONObject.fromObject(returnJson);
    this.returnStr = jo.toString();
    return SUCCESS;
  }