@Override
 public void edit(Menu menu) {
   if (menu.getId() == null) throw new IllegalArgumentException("id argument is null");
   if (menu.getTitle() == null) throw new IllegalArgumentException("title argument is null");
   if (menu.getPid() == null) throw new IllegalArgumentException("pid argument is null");
   if (menu.getUrl() == null) throw new IllegalArgumentException("url argument is null");
   if (menu.getSorder() == null) throw new IllegalArgumentException("sorder argument is null");
   menu.setDeleteflag(0);
   this.baseDaoSupport.update("menu", menu, "id=" + menu.getId());
 }
 /**
  * 在一个集合中查找子
  *
  * @param menuList 所有菜单集合
  * @param parentid 父id
  * @return 找到的子集合
  */
 private List<Menu> getChildren(List<Menu> menuList, Integer parentid) {
   List<Menu> children = new ArrayList<Menu>();
   for (Menu menu : menuList) {
     if (menu.getPid().compareTo(parentid) == 0) {
       menu.setChildren(this.getChildren(menuList, menu.getId()));
       children.add(menu);
     }
   }
   return children;
 }
 @Override
 public Integer add(Menu menu) {
   if (menu.getTitle() == null) throw new IllegalArgumentException("title argument is null");
   if (menu.getPid() == null) throw new IllegalArgumentException("pid argument is null");
   if (menu.getUrl() == null) throw new IllegalArgumentException("url argument is null");
   if (menu.getSorder() == null) throw new IllegalArgumentException("sorder argument is null");
   menu.setDeleteflag(0);
   this.baseDaoSupport.insert("menu", menu);
   return this.baseDaoSupport.getLastId("menu");
 }
 @Override
 public List<Menu> getMenuTree(Integer menuid) {
   if (menuid == null) throw new IllegalArgumentException("menuid argument is null");
   List<Menu> menuList = this.getMenuList();
   List<Menu> topMenuList = new ArrayList<Menu>();
   for (Menu menu : menuList) {
     if (menu.getPid().compareTo(menuid) == 0) {
       List<Menu> children = this.getChildren(menuList, menu.getId());
       menu.setChildren(children);
       topMenuList.add(menu);
     }
   }
   return topMenuList;
 }