Ejemplo n.º 1
0
  @Override
  protected Resultable queryResult(
      QueryFactory queryFactory, String cacheKey, int rows, int page, Order order) {
    EntityQueryable query =
        queryFactory
            .createEntityQuery(EnterpriseBasic.class)
            .setPage(page)
            .setRow(rows)
            .orderDesc("id");

    query.eq("channelId", getChannelId());

    Long id = getParameterValue(Long.class, "id", "查询编号错误,应该是整型");
    if (isNotNull(id)) query.eq("id", id);

    String name = getParameterValue(String.class, "name", "");
    if (isStringNotEmpty(name)) query.likeAnywhere("name", name);

    if (!EwcmsContextUtil.getGroupnames().contains("GROUP_ADMIN")) {
      Organ organ = particularFac.findOrganByUserName();
      if (organ == null) {
        query.eq("organ.id", null);
      } else {
        query.eq("organ.id", organ.getId());
      }
    }

    entityOrder(query, order);
    return query.queryCacheResult(cacheKey);
  }
Ejemplo n.º 2
0
  @Override
  protected Resultable querySelectionsResult(
      QueryFactory queryFactory, int rows, int page, String[] selections, Order order) {
    EntityQueryable query =
        queryFactory
            .createEntityQuery(EnterpriseBasic.class)
            .setPage(page)
            .setRow(rows)
            .orderDesc("id");

    query.eq("channelId", getChannelId());

    if (!EwcmsContextUtil.getGroupnames().contains("GROUP_ADMIN")) {
      Organ organ = particularFac.findOrganByUserName();
      if (organ == null) {
        query.eq("organ.id", null);
      } else {
        query.eq("organ.id", organ.getId());
      }
    }

    List<Long> ids = getIds(Long.class);
    query.in("id", ids);

    return query.queryResult();
  }