private ChooseOrganizationResponse queryStaff(ChooseOrganizationRequest request) {
    StaffSearchCriteria criteria = new StaffSearchCriteria();
    if (request.getCriteria().getPagination() != null) {
      PaginationDetail detail = new PaginationDetail();
      detail.setLimit(request.getCriteria().getPagination().getLimit());
      detail.setStart(request.getCriteria().getPagination().getStart());

      criteria.setPaginationDetail(detail);
    }

    if (request.getCriteria().getSorting() != null) {
      SortingDetail sortingDetail = new SortingDetail();
      sortingDetail.setSort(request.getCriteria().getSorting().getSort());
      sortingDetail.setDirection(request.getCriteria().getSorting().getDirection());
      criteria.setSortingDetail(sortingDetail);
    }
    if (request.getCriteria().getKey() != null)
      criteria.setStaffNameorNo(request.getCriteria().getKey());

    UserContext context = new UserContext();
    context.setCorporationId(request.getSession().getCorporationId());
    context.setUserId(request.getSession().getToken());
    context.setLoginName(request.getSession().getLoginName());
    context.setUserRoles(UserRoleTool.adaptToRole(request.getSession().getUserRoles()));

    QueryStaffPageActionResult result = staffService.queryStaffList(criteria, context);

    List<OrganicationClient> lt = new ArrayList<OrganicationClient>();

    for (Staff staff : result.getResultList()) {
      OrganicationClient client = new OrganicationClient();
      client.setId(staff.getId());
      client.setName(staff.getName());
      client.setType(OrganType.STAFF);
      lt.add(client);
    }
    OrganSearchResult rs = new OrganSearchResult();
    rs.setResult(lt);
    rs.setTotal(result.getTotal());
    return new ChooseOrganizationResponse(rs);
  }
  private ChooseOrganizationResponse queryGroup(ChooseOrganizationRequest request) {
    UserContext context = new UserContext();
    context.setCorporationId(request.getSession().getCorporationId());
    context.setUserId(request.getSession().getToken());
    context.setLoginName(request.getSession().getLoginName());
    context.setUserRoles(UserRoleTool.adaptToRole(request.getSession().getUserRoles()));

    TeamListVo teamListVo = new TeamListVo();
    if (request.getCriteria().getPagination() != null) {
      PaginationDetail detail = new PaginationDetail();
      detail.setLimit(request.getCriteria().getPagination().getLimit());
      detail.setStart(request.getCriteria().getPagination().getStart());

      teamListVo.setPaginationDetail(detail);
    }
    if (request.getCriteria().getKey() != null) teamListVo.setName(request.getCriteria().getKey());

    if (request.getCriteria().getSorting() != null) {
      SortingDetail sortingDetail = new SortingDetail();
      sortingDetail.setSort(request.getCriteria().getSorting().getSort());
      sortingDetail.setDirection(request.getCriteria().getSorting().getDirection());
      teamListVo.setSortingDetail(sortingDetail);
    }

    OrganSearchResult rs = new OrganSearchResult();
    List<OrganicationClient> lt = new ArrayList<OrganicationClient>();

    PageStore<TeamListVo> volist = teamService.teamList(context, teamListVo);
    for (TeamListVo team : volist.getResultList()) {
      OrganicationClient client = new OrganicationClient();
      client.setId(team.getId());
      client.setName(team.getName());
      client.setType(OrganType.GROUP);
      lt.add(client);
    }

    rs.setResult(lt);
    rs.setTotal(volist.getResultCount());
    return new ChooseOrganizationResponse(rs);
  }