Search in sources :

Example 1 with QFaculty

use of hse.holuhoev.domain.QFaculty in project hse-cws by holuhoev.

the class FacultyDatasource method getFacultyFilter.

public DataSourceResult getFacultyFilter(final Integer instituteId, final String name) {
    QFaculty qFaculty = QFaculty.faculty;
    BooleanBuilder builder = new BooleanBuilder();
    if (instituteId != null) {
        builder.and(qFaculty.instituteId.eq(instituteId));
    }
    if (name != null && !name.isEmpty()) {
        builder.and(qFaculty.name.containsIgnoreCase(name));
    }
    Sort sort = new Sort(Sort.Direction.ASC, "name");
    Iterable<Faculty> faculties = facultyRepository.findAll(builder, sort);
    return DataSourceResult.create(faculties);
}
Also used : QFaculty(hse.holuhoev.domain.QFaculty) Faculty(hse.holuhoev.domain.Faculty) QFaculty(hse.holuhoev.domain.QFaculty) BooleanBuilder(com.querydsl.core.BooleanBuilder) Sort(org.springframework.data.domain.Sort)

Aggregations

BooleanBuilder (com.querydsl.core.BooleanBuilder)1 Faculty (hse.holuhoev.domain.Faculty)1 QFaculty (hse.holuhoev.domain.QFaculty)1 Sort (org.springframework.data.domain.Sort)1