use of hse.holuhoev.domain.QGroup in project hse-cws by holuhoev.
the class GroupDatasource method getGroupFilter.
public DataSourceResult getGroupFilter(final Integer facultyId, final Integer instituteId, final Course course, final String number, final EducationType educationType) {
QGroup qGroup = QGroup.group;
BooleanBuilder builder = new BooleanBuilder();
if (facultyId != null) {
builder.and(qGroup.facultyId.eq(facultyId));
}
if (instituteId != null) {
builder.and(qGroup.instituteId.eq(instituteId));
}
if (course != null) {
builder.and(qGroup.course.eq(course));
}
if (number != null) {
builder.and(qGroup.number.containsIgnoreCase(number));
}
if (educationType != null) {
builder.and(qGroup.educationType.eq(educationType));
}
Sort sort = new Sort(Sort.Direction.ASC, "course", "number");
Iterable<Group> groups = groupRepository.findAll(builder, sort);
return DataSourceResult.create(groups, new HashMap<>());
}
Aggregations