@Override public void openCreate(Object myaction) throws Exception { DepartAction action = (DepartAction) myaction; if (action.getTsysDepart() != null) { String departid = action.getTsysDepart().getDepartid(); String updepartid = action.getTsysDepart().getUpdepartid(); if (departid != null) { TSysDepart object = (TSysDepart) getBaseDao().findById(TSysDepart.class, departid); action.setTsysDepart(object); if ("1".equals(object.getDeparttype())) { // 省中心 action.setUpdepartid("0"); action.setUpdepartname(""); } else { TSysDepart upobject = (TSysDepart) getBaseDao().findById(TSysDepart.class, object.getUpdepartid()); action.setUpdepartid(upobject.getDepartid()); action.setUpdepartname(upobject.getDepartname()); } TDepartDetail tdepartDetail = (TDepartDetail) getBaseDao().findById(TDepartDetail.class, departid); action.setDepartDetail(tdepartDetail); } else if (updepartid != null) { TSysDepart object = (TSysDepart) getBaseDao().findById(TSysDepart.class, updepartid); action.setUpdepartid(object.getDepartid()); action.setUpdepartname(object.getDepartname()); } } }
public void load(Object myaction) throws Exception { DepartAction action = (DepartAction) myaction; if (action.getDepart() != null) { String departid = action.getDepart().getDepartid(); if (departid != null) { TSysDepart object = (TSysDepart) getBaseDao().findById(TSysDepart.class, departid); action.setTsysDepart(object); } String updepartid = action.getDepart().getUpdepartid(); if (updepartid != null) { TSysDepart object = (TSysDepart) getBaseDao().findById(TSysDepart.class, updepartid); object.setDepartid(null); object.setDepartcode(null); object.setDepartname(null); action.setTsysDepart(object); } } }