org.jooq.TableField.as()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(5.4k)|赞(0)|评价(0)|浏览(128)

本文整理了Java中org.jooq.TableField.as()方法的一些代码示例,展示了TableField.as()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。TableField.as()方法的具体详情如下:
包路径:org.jooq.TableField
类名称:TableField
方法名:as

TableField.as介绍

暂无

代码示例

代码示例来源:origin: k55k32/cms-admin-end

private PageResult<Article> searchPageByCondition(PageResult<Article> page, Stream<Condition> cond) {
  page = dao.fetch(page, e -> {
    return e.select(Fields.all(C_ARTICLE.fields(),C_CATALOG.NAME.as("catalogName")))
    .from(C_ARTICLE)
    .leftJoin(C_CATALOG).on(C_ARTICLE.CATALOG_ID.eq(C_CATALOG.ID))
    .where(cond.collect(Collectors.toList()))
    .orderBy(C_ARTICLE.CREATE_TIME.desc());
  }, Article.class);
  List<Article> articles = page.getData();
  if (!articles.isEmpty()) {
    Map<String,Article> articlesMap = articles.stream().collect(Collectors.toMap(Article::getId, a -> {
      a.setTags(new ArrayList<>());
      return a;
    }));
    List<ArticleTag> articleTags = articleTagService.findTags(articlesMap.keySet());
    articleTags.forEach(articleTag -> {
      articlesMap.get(articleTag.getArticleId()).getTags().add(articleTag.getTag());
    });
  }
  return page;
}

代码示例来源:origin: org.jooq/jooq-meta

? when(condition("{0} && ARRAY['o','b']::\"char\"[]", PG_PROC.PROARGMODES), inline("void"))
 .otherwise(r1.DATA_TYPE).as("data_type")
: r1.DATA_TYPE.as("data_type"),

代码示例来源:origin: k55k32/cms-admin-end

public PageResult<Comment> page(PageResult<Comment> page, Optional<Integer> state, Optional<String> articleId) {
  List<Condition> conditions = new ArrayList<>();
  state.ifPresent(s ->{
    conditions.add(comment.STATE.eq(s));
  });
  articleId.ifPresent(a ->{
    conditions.add(comment.ARTICLE_ID.eq(a));
  });
  return dao.fetch(page, e -> {
    return e.select(Fields.all(comment.fields(), article.TITLE.as("articleTitle")))
    .from(comment)
    .leftJoin(article).on(comment.ARTICLE_ID.eq(article.ID))
    .where(conditions).orderBy(comment.CREATE_TIME.desc());
  }, Comment.class);
}

代码示例来源:origin: org.jooq/jooq-meta

Proc.DB.as(Routines.ROUTINE_SCHEMA),
  Proc.NAME.as(Routines.ROUTINE_NAME),
  Proc.COMMENT.as(Routines.ROUTINE_COMMENT),
  Proc.PARAM_LIST,
  Proc.RETURNS,
  Proc.TYPE.as(Routines.ROUTINE_TYPE))
.from(PROC)
.where(Proc.DB.in(getInputSchemata()))

代码示例来源:origin: com.walmartlabs.concord.server/concord-server

@WithTimer
public QueueMetrics metrics(UUID orgId, UUID prjId, Set<String> statuses) {
  return txResult(tx -> {
    SelectConditionStep<Record4<Integer, Integer, Integer, String>> q = tx.select(
        field("1", Integer.class).as("count_process"),
        when(V_PROCESS_QUEUE.ORG_ID.eq(orgId), 1).otherwise(0).as("count_per_org"),
        when(V_PROCESS_QUEUE.PROJECT_ID.eq(prjId), 1).otherwise(0).as("count_per_project"),
        V_PROCESS_QUEUE.CURRENT_STATUS.as("status"))
        .from(V_PROCESS_QUEUE)
        .where(V_PROCESS_QUEUE.CURRENT_STATUS.in(statuses));
    List<Record4<BigDecimal, BigDecimal, BigDecimal, String>> result = tx.select(
        sum(q.field("count_process", Integer.class)),
        sum(q.field("count_per_org", Integer.class)),
        sum(q.field("count_per_project", Integer.class)),
        q.field("status", String.class))
        .from(q)
        .groupBy(q.field("status", String.class))
        .fetch();
    Map<String, Integer> process = new HashMap<>();
    Map<String, Integer> perOrg = new HashMap<>();
    Map<String, Integer> perProject = new HashMap<>();
    result.forEach(r -> {
      String status = r.value4();
      process.put(status, getInt(r.value1()));
      perOrg.put(status, getInt(r.value2()));
      perProject.put(status, getInt(r.value3()));
    });
    return new QueueMetrics(process, perOrg, perProject);
  });
}

代码示例来源:origin: k55k32/cms-admin-end

public ArticleDetail getDetail(String id) {
  CArticle article = C_ARTICLE.as("a");
  CArticle before = C_ARTICLE.as("b");
  CArticle next = C_ARTICLE.as("n");
  CArticle inner = C_ARTICLE.as("i");
  ArticleDetail a = dao.execute(e -> {
    return e.select(Fields.all(article.fields(),
      before.ID.as("beforeId"),
      before.TITLE.as("beforeTitle"),
      next.ID.as("nextId"),
      next.TITLE.as("nextTitle")
      )).from(article)
      .leftJoin(before).on(before.ID.eq(e.select(inner.ID).from(inner).where(article.CREATE_TIME.ge(inner.CREATE_TIME)).and(inner.ID.ne(article.ID).and(inner.STATUS.eq(Article.STATUS_PUBLISH))).orderBy(inner.CREATE_TIME.desc()).limit(0, 1)))
      .leftJoin(next).on((next.ID.eq(e.select(inner.ID).from(inner).where(article.CREATE_TIME.le(inner.CREATE_TIME)).and(inner.ID.ne(article.ID).and(inner.STATUS.eq(Article.STATUS_PUBLISH))).orderBy(inner.CREATE_TIME).limit(0, 1))))
      .where(article.ID.eq(id))
      .fetchOne(r -> {
        return dao.mapperEntityEx(r, ArticleDetail.class);
      });
  });
  List<Tag> tags = articleTagService.findTags(a.getId());
  a.setTags(tags);
  return a;
}

代码示例来源:origin: k55k32/cms-admin-end

public List<Article> findAll(int status) {
  final Field<?> catalogName = C_CATALOG.NAME.as("catalogName");
  List<Article> list = dao.execute(e -> {
    return e.select(Fields.all(C_ARTICLE.fields(),catalogName))
    .from(C_ARTICLE)
    .leftJoin(C_CATALOG).on(C_ARTICLE.CATALOG_ID.eq(C_CATALOG.ID))
    .where(C_ARTICLE.STATUS.eq(status))
    .orderBy(C_ARTICLE.CREATE_TIME.desc());
  }).fetch(r -> {
    Article art = r.into(Article.class);
    art.setCatalogName(r.get(catalogName, String.class));
    return art;
  });
  return list;
}

代码示例来源:origin: org.jooq/jooq-meta

TABLES.TABLE_SCHEMA,
TABLES.TABLE_NAME,
TABLES.TABLE_NAME.as("specific_name"),
inline(false).as("table_valued_function"),
inline(false).as("materialized_view"),

相关文章