Jooq比较偏的用法

count

  public Integer count(Integer id) {
    return dslContext.selectCount().from(Tables.)
        .where(Tables..ID.eq(id)).fetchOne(0, Integer.class);
  }

like   order by case when then  按照匹配度排序

  public List<> searchSymptomsByKey(String keyStr) {
    String key = keyStr.replace("%", "");
    return dslContext.select().from(Tables.)
        .where(Tables...like(keyStr))
        .orderBy(DSL.decode().when(Tables...like(key), 0)
            .when(Tables...like("%" + key), 1)
            .when(Tables...like("%" + key + "%"), 2).otherwise(3).asc())
        .fetchInto(.class);
  } 
    
   

为true的Condition

Condition condition = DSL.trueCondition();

 

转载于:https://www.cnblogs.com/badboyf/p/6485167.html

你可能感兴趣的:(Jooq比较偏的用法)