public Integer addSite(Integer parentId, String siteName, Integer organId) { Site vo = new Site(); vo.setSiteName(siteName); if (parentId != null) vo.setParent(siteDAO.get(parentId)); Organ organVo = new Organ(); organVo.setId(organId); vo.setOrgan(organVo); siteDAO.persist(vo); return vo.getId(); }
public Integer updSite(Site vo) { siteDAO.merge(vo); Site currSite = getCurSite(); if (currSite != null) { if (currSite.getId() == vo.getId()) { initSiteInContext(vo); } } return vo.getId(); }
/** 获取子站点. */ public List<TreeNode> getSiteChildren(Integer parentId, Integer organId) { List<TreeNode> tnList = new ArrayList<TreeNode>(); List<Site> siteList = siteDAO.getSiteChildren(parentId, organId); for (Site vo : siteList) { TreeNode tnVo = new TreeNode(); tnVo.setId(vo.getId().toString()); tnVo.setText(vo.getSiteName()); if (vo.hasChildren()) { tnVo.setState("closed"); } else { tnVo.setState("open"); } tnList.add(tnVo); } return tnList; }
public void updSiteParent(Integer organId, Integer parentId, Integer newParentId) { siteDAO.updSiteParent(organId, parentId, newParentId); }
public List<Site> getSiteListByOrgans(Integer[] organs, Boolean publicenable) { return siteDAO.getSiteListByOrgans(organs, publicenable); }
public Site getSite(Integer id) { return siteDAO.get(id); }
public void delSite(Integer id) { siteDAO.removeByPK(id); }