/** * 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"; }
/** 编辑实体 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"; }
/** 编辑实体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"; }
// 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; }