/**
   * 根据ID返回详细信息
   *
   * @param
   * @return
   * @throws
   */
  public List treeList(IBaseDTO dto, PageInfo pi, String id) {

    List list = new ArrayList();

    LeafRightSearch lrs = new LeafRightSearch();

    Object[] result = (Object[]) dao.findEntity(lrs.treeList(dto, pi, id));
    num = dao.findEntitySize(lrs.treeList(dto, pi, id));
    for (int i = 0, size = result.length; i < size; i++) {
      SysLeafRight slr = (SysLeafRight) result[i];
      DynaBeanDTO dbd = new DynaBeanDTO();

      dbd.set("id", slr.getId());
      dbd.set("treeId", slr.getId());
      dbd.set("treeType", slr.getType());
      dbd.set("label", slr.getLabel());
      dbd.set("nickName", slr.getNickName());
      String remark = slr.getRemark() == null ? "" : slr.getRemark();
      if (remark.length() > 15) {
        remark = remark.substring(0, 15);
      }
      dbd.set("remark", remark);
      dbd.set("icon", slr.getIcon());
      list.add(dbd);
    }
    return list;
  }
  public void deleteRoleRights(String roleId, String treeId) {
    Object[] o = dao.findEntity(searchHelp.searchRightRole(roleId, treeId));

    for (int i = 0; i < o.length; i++) {
      SysRightRole srr = (SysRightRole) o[i];
      dao.removeEntity(srr);
    }
    dao.flush();
  }
 public List<LabelValueBean> getLabelList() {
   MeetingSearchHelp msh = new MeetingSearchHelp();
   Object[] objs = dao.findEntity(msh.searchMeetingRoom());
   List l = new ArrayList();
   for (int i = 0, size = objs.length; i < size; i++) {
     ResourceInfo ri = (ResourceInfo) objs[i];
     DynaBeanDTO dbd = new DynaBeanDTO();
     l.add(new LabelValueBean(ri.getResourceName(), ri.getId()));
   }
   return l;
 }
  public List<IBaseDTO> listUser(IBaseDTO dto, PageInfo pi) {
    // TODO 需要写出方法的具体实现
    UserHelp uh = new UserHelp();
    Object[] o = dao.findEntity(uh.listUserMQ(dto, pi));
    ArrayList l = new ArrayList();
    if (null != o && o.length > 0) {
      for (Object oo : o) {
        SysUser su = ((SysUser) oo);
        IBaseDTO tdto = createDTOByPo(su);

        IBaseDTO gdto = this.groupService.uniqueGroup(su.getSysGroup().getId());
        IBaseDTO rdto = this.roleService.getRoleInfo(su.getSysRole().getId());
        tdto.set("groupName", gdto.get("name"));
        tdto.set("roleName", rdto.get("name"));
        l.add(tdto);
      }
      return l;
    }
    return l;
  }
 /**
  * 得到叶子节点权限列表
  *
  * @param nodeId
  * @return List<SysLeafRight>
  */
 public List<DynaBeanDTO> getLeafRightByNodeId(String nodeId) {
   List<DynaBeanDTO> rights = new ArrayList<DynaBeanDTO>();
   if (nodeId != null) {
     String hql = "from SysLeafRight where a.baseTree.id = '" + nodeId + "' order by a.nickName";
     MyQuery mq = new MyQueryImpl();
     mq.setHql(hql);
     Object[] o = dao.findEntity(searchHelp.searchLeafRightByNodeId(nodeId));
     DynaBeanDTO dto = null;
     for (int i = 0; i < o.length; i++) {
       dto = new DynaBeanDTO();
       SysLeafRight right = (SysLeafRight) o[i];
       dto.set("id", right.getId());
       dto.set("treeId", right.getBaseTree().getId());
       dto.set("treeName", right.getBaseTree().getLabel());
       dto.set("type", right.getType());
       dto.set("nickName", right.getNickName());
       dto.set("deleteMark", right.getDeleteMark());
       dto.set("remark", right.getRemark());
       rights.add(dto);
     }
   }
   return rights;
 }