count
public Integer count(Integer id) { return dslContext.selectCount().from(Tables.<table_name>) .where(Tables.<table_name>.ID.eq(id)).fetchOne(0, Integer.class); }
like order by case when then 按照匹配度排序
public List<<table_name>> searchSymptomsByKey(String keyStr) { String key = keyStr.replace("%", ""); return dslContext.select().from(Tables.<table_name>) .where(Tables.<table>.<filed>.like(keyStr)) .orderBy(DSL.decode().when(Tables.<table_name>.<field>.like(key), 0) .when(Tables.<table_name>.<filed>.like("%" + key), 1) .when(Tables.<table_name>.<field>.like("%" + key + "%"), 2).otherwise(3).asc()) .fetchInto(<table_name>.class); }
为true的Condition
Condition condition = DSL.trueCondition();