public String listAjax() {
   CmsRequestlogQuery query = newQuery(CmsRequestlogQuery.class, DEFAULT_SORT_COLUMNS);
   String sort = this.getRequest().getParameter("sort");
   if (StringUtils.isNotEmpty(sort)) query.setSortColumns(sort);
   Page page = cmsRequestlogManager.findPage(query);
   Map map = new HashMap();
   map.put("total", page.getTotalCount());
   map.put("rows", page.getResult());
   return writeAjaxResponse(Json.toJson(map));
 }
示例#2
0
  public static Page pageQuery(
      SqlSessionTemplate sqlSessionTemplate,
      String statementName,
      String countStatementName,
      PageRequest pageRequest) {

    Number totalCount = (Number) sqlSessionTemplate.selectOne(countStatementName, pageRequest);
    if (totalCount == null || totalCount.longValue() <= 0) {
      return new Page(pageRequest, 0);
    }

    Page page = new Page(pageRequest, totalCount.intValue());

    // 其它分页参数,用于不喜欢或是因为兼容性而不使用方言(Dialect)的分页用户使用.
    // 与getSqlMapClientTemplate().queryForList(statementName, parameterObject)配合使用
    Map filters = new HashMap();
    filters.put("offset", page.getFirstResult());
    filters.put("pageSize", page.getPageSize());
    filters.put("lastRows", page.getFirstResult() + page.getPageSize());
    filters.put("sortColumns", pageRequest.getSortColumns());

    Map parameterObject = PropertyUtils.describe(pageRequest);
    filters.putAll(parameterObject);

    List list =
        sqlSessionTemplate.selectList(
            statementName, filters, page.getFirstResult(), page.getPageSize());
    page.setResult(list);
    return page;
  }
示例#3
0
  protected Page pageQuery(String statementName, PageRequest pageRequest) {

    Number totalCount =
        (Number)
            this.getSqlMapClientTemplate()
                .queryForObject(getCountQuery(statementName), pageRequest.getFilters());
    if (totalCount == null || totalCount.longValue() <= 0) {
      return new Page(pageRequest, 0);
    }
    Page page = new Page(pageRequest, totalCount.intValue());

    // 其它分页参数,用于不喜欢或是因为兼容性而不使用方言(Dialect)的分页用户使用.
    // 与getSqlMapClientTemplate().queryForList(statementName, parameterObject)配合使用
    Map otherFilters = new HashMap();
    otherFilters.put("offset", page.getFirstResult());
    otherFilters.put("pageSize", page.getPageSize());
    otherFilters.put("lastRows", page.getFirstResult() + page.getPageSize());
    otherFilters.put("sortColumns", pageRequest.getSortColumns());

    // 混合两个filters为一个filters,MapAndObject.get()方法将在两个对象取值,Map如果取值为null,则再在Bean中取值
    Map parameterObject = new MapAndObject(otherFilters, pageRequest.getFilters());
    List list =
        getSqlMapClientTemplate()
            .queryForList(
                statementName, parameterObject, page.getFirstResult(), page.getPageSize());
    page.setResult(list);
    return page;
  }
示例#4
0
  /**
   * 发起测评 -- 跨单位
   *
   * @return
   */
  public String outUserList() {
    Page page = this.userManager.findOutPage(query, this.getCurrUser().getDeptIDs());
    String userId = query.getId();
    List<User> userList = page.getResult();

    for (User user : userList) {
      String uId = user.getId();
      if (!isNullOrEmptyString(userId)) {
        if (userId.indexOf(uId) != -1) {
          user.setChecked("1");
        }
      }
    }

    super.saveCurrentPage(page, query);
    return "outUserList";
  }
示例#5
0
  public String sponsorList() {
    Page page = this.userManager.findHead(query);
    String userId = query.getId();
    List<User> usersList = page.getResult();

    for (User user : usersList) {
      String uId = user.getId();
      if (!isNullOrEmptyString(userId)) {
        if (userId.indexOf(uId) != -1) {
          user.setChecked("1");
        }
      }
    }

    this.saveCurrentPage(page, query);
    return "sponsorList";
  }
  /**
   * 用于一个页面有多个extremeTable是使用
   *
   * @param tableId 等于extremeTable的tableId属性
   */
  public void savePage(String tableId, Page page, PageRequest pageRequest) {
    Assert.notNull(tableId, "tableId must be not null");
    Assert.notNull(page, "page must be not null");

    getRequest().setAttribute(tableId + "page", page);
    getRequest().setAttribute(tableId + "totalRows", new Integer(page.getTotalCount()));
    getRequest().setAttribute(tableId + "pageRequest", pageRequest);
    getRequest().setAttribute(tableId + "query", pageRequest);
  }
示例#7
0
 /**
  * 去分配组织机构页面
  *
  * @return
  */
 public String toGrantOrganizPage() {
   OrganizationQuery orgQuery = new OrganizationQuery();
   BeanUtils.copyProperties(orgQuery, query);
   orgQuery.setDf("0");
   orgQuery.setPageSize(Integer.MAX_VALUE);
   Page page = organizationManager.findPage(orgQuery);
   List<Organization> l = page.getResult();
   String selectIds = this.partition.getOrgIds();
   for (Organization org : l) {
     if (StrUtil.isNotNullOrBlank(selectIds)) {
       if (selectIds.indexOf(org.getId()) != -1) {
         org.setChecked("checked");
       }
     }
   }
   this.saveCurrentPage(page, query);
   return GRANT_ORGANIZ_JSP;
 }
示例#8
0
  /**
   * 加载用户列表,用于选择用户组件
   *
   * @return
   */
  @SuppressWarnings("unchecked")
  public String loadUserList() {
    query.setDf("0");
    // 如果是取某分区下的用户,根据分区下的组织机构取得所有用户
    if (partitionId != null && !"".equals(partitionId)) {
      Partition partition = partitionManager.getById(partitionId);
      if (partition != null) {
        query.setOrganizIds(organizationManager.findAllChildByPartition(partition));
      }
    }

    Page page = this.organizationUserRelationManager.findByUserPage(query);
    page = userManager.findPage(query);

    List<User> users = page.getResult();
    // 处理部门列表
    for (User user : users) {
      user.setDeptsString("");
      if (user.getOuRelations() != null) {
        StringBuffer sb = new StringBuffer();
        for (OrganizationUserRelation our : user.getOuRelations()) {
          if (our.getOrganization() != null) {
            sb.append(our.getOrganization().getName() + ",");
          }
        }
        user.setDeptsString(sb.toString());
      }
    }
    // 性别
    for (User user : users) {
      /*if (user.getSex() != null && !user.getSex().equals("")) {
      	this.sexMap = this.dicUtil.getDicList("DICT_SEX");
      	user.setSexString(this.sexMap.get(user.getSex()));
      }*/
    }
    this.saveCurrentPage(page, query);
    return "loadUserList";
  }
示例#9
0
  /**
   * 执行搜索
   *
   * @return
   */
  @SuppressWarnings("unchecked")
  public String list() {

    // Flash.current().clear();

    /*// 删除标记的不显示
    query.setDf("0");
    // 启用状态
    query.setAbledFlag(this.abledFlag);
    // 如果是取某分区下的用户,根据分区下的组织机构取得所有用户
    if (partitionId != null && !"".equals(partitionId)) {
    	Partition partition = partitionManager.getById(partitionId);
    	if (partition != null) {
    		query.setOrganizIds(organizationManager.findAllChildByPartition(partition));
    	}
    }*/

    Page page = this.organizationUserRelationManager.findByUserPage(query);

    List<User> users = page.getResult();
    // 处理部门列表
    for (User user : users) {
      user.setDeptsString("");
      if (user.getOuRelations() != null) {
        StringBuffer sb = new StringBuffer();
        for (OrganizationUserRelation our : user.getOuRelations()) {
          if (our.getOrganization() != null) {
            sb.append(our.getOrganization().getName() + ",");
          }
        }
        user.setDeptsString(sb.toString());
      }
    }

    this.saveCurrentPage(page, query);
    return LIST_JSP;
  }
示例#10
0
  @SuppressWarnings("unchecked")
  public String loadExtSubsTree(final HttpServletRequest pRequest, LeafInfo leafInfo)
      throws Exception {

    final Long parentID = leafInfo.getLeafParentId();
    final String parentTYPE = leafInfo.getLeafParentType();

    PageRequest pageRequest = bindPageRequest(pRequest, leafInfo, DEFAULT_SORT_COLUMNS);
    pageRequest.setPageSize(1000);

    Page nodesPages = leafInfoManager.findByPageRequest(pageRequest);

    AbstractWebTreeModelCreator treeModelCreator =
        new AbstractWebTreeModelCreator() {
          @Override
          protected Node createNode(Object pUserData, UserDataUncoder pUncoder) {
            LeafInfo leaf = (LeafInfo) pUserData;
            WebTreeDynamicNode result =
                new WebTreeDynamicNode(
                    leaf.getLeafName(), leaf.getLeafType() + "_" + leaf.getLeafId());
            result.setSubTreeURL(
                getUrl(
                    "/tree/"
                        + leaf.getLeafId()
                        + "?"
                        + PARENT_ID
                        + "="
                        + leaf.getLeafId()
                        + "&"
                        + PARENT_TYPE
                        + "="
                        + leaf.getLeafType()
                        + "&random="
                        + Math.random()));

            result.setValue(String.valueOf(leaf.getLeafId()));
            result.setTip(leaf.getLeafName());

            // 台区
            if (SystemConst.TREE_TG.equals(leaf.getLeafType())) {
              result.setIcon(getUrl(TG_IMG));
              result.setAction("javascript:showTg(" + leaf.getLeafId() + ")");
            } else if (SystemConst.TREE_ORG.equals(leaf.getLeafType())) {
              result.setIcon(getUrl(ORG_IMG));
              result.setAction("javascript:showOrg(" + leaf.getLeafId() + ")");
            }

            return result;
          }
        };
    treeModelCreator.init(pRequest);

    TreeModel treeModel =
        treeModelCreator.create(
            nodesPages.getResult(),
            new UserDataUncoder() {

              public Object getParentID(Object arg) throws UncodeException {

                return parentID;
              }

              public Object getID(Object arg) throws UncodeException {
                return ((LeafInfo) arg).getLeafId();
              }
            });

    TreeDirector director = new DefaultTreeDirector();
    director.setComparator(new DefaultNodeComparator());
    WebTreeBuilder treeBuilder = new ExtSubTreeBuilder();
    treeBuilder.init(pRequest);
    director.build(treeModel, treeBuilder);

    String treeScript = treeBuilder.getTreeScript();

    return treeScript;
  }