use of org.jooq.SelectConditionStep in project collect by openforis.
the class TaxonVernacularNameDao method findByVernacularName.
public List<TaxonVernacularName> findByVernacularName(int taxonomyId, String searchString, String[] qualifierValues, int maxResults) {
TaxonVernacularNameDSLContext dsl = dsl();
// find containing
searchString = "%" + searchString.toLowerCase(Locale.ENGLISH) + "%";
SelectConditionStep selectConditionStep = dsl.select(OFC_TAXON_VERNACULAR_NAME.fields()).from(OFC_TAXON_VERNACULAR_NAME).join(OFC_TAXON).on(OFC_TAXON.ID.equal(OFC_TAXON_VERNACULAR_NAME.TAXON_ID)).where(OFC_TAXON.TAXONOMY_ID.equal(taxonomyId).and(DSL.lower(OFC_TAXON_VERNACULAR_NAME.VERNACULAR_NAME).like(searchString)));
if (qualifierValues != null) {
for (int i = 0; i < qualifierValues.length; i++) {
String value = qualifierValues[i];
if (value != null) {
TableField field = QUALIFIER_FIELDS[i];
selectConditionStep.and(field.equal(value));
}
}
}
selectConditionStep.limit(maxResults);
Result<?> result = selectConditionStep.fetch();
List<TaxonVernacularName> entities = dsl.fromResult(result);
return entities;
}
use of org.jooq.SelectConditionStep in project collect by openforis.
the class TaxonVernacularNameDao method findByTaxon.
public List<TaxonVernacularName> findByTaxon(int taxonId) {
TaxonVernacularNameDSLContext dsl = dsl();
SelectConditionStep selectConditionStep = dsl.select(OFC_TAXON_VERNACULAR_NAME.fields()).from(OFC_TAXON_VERNACULAR_NAME).where(OFC_TAXON_VERNACULAR_NAME.TAXON_ID.equal(taxonId));
Result<?> result = selectConditionStep.fetch();
List<TaxonVernacularName> entities = dsl.fromResult(result);
return entities;
}
use of org.jooq.SelectConditionStep in project collect by openforis.
the class TaxonVernacularNameDao method deleteByTaxonomy.
public void deleteByTaxonomy(int taxonomyId) {
TaxonVernacularNameDSLContext dsl = dsl();
SelectConditionStep selectTaxonIds = dsl.select(OFC_TAXON.ID).from(OFC_TAXON).where(OFC_TAXON.TAXONOMY_ID.equal(taxonomyId));
dsl.delete(OFC_TAXON_VERNACULAR_NAME).where(OFC_TAXON_VERNACULAR_NAME.TAXON_ID.in(selectTaxonIds)).execute();
}
Aggregations