Allow to search organizations based on reference
This commit is contained in:
parent
fe8a0ff109
commit
a155f2cbec
|
@ -26,6 +26,9 @@ public class OrganisationDaoImpl extends DatabaseAccess<Organisation> implements
|
|||
@Override
|
||||
public QueryableList<Organisation> getWithCriteria(OrganisationCriteria criteria) {
|
||||
QueryableList<Organisation> query = this.getDatabaseService().getQueryable(Organisation.class);
|
||||
if (criteria.getLabelLike() != null && criteria.getLike() != null) {
|
||||
query.where((builder, root) -> builder.or(builder.equal(root.get("reference"), criteria.getLike()), builder.like(builder.upper(root.get("label")), "%" + criteria.getLabelLike().toUpperCase() + "%")));
|
||||
} else {
|
||||
if (criteria.getLike() != null)
|
||||
query.where((builder, root) -> builder.equal(root.get("reference"), criteria.getLike()));
|
||||
if (criteria.getLabelLike() != null) {
|
||||
|
@ -34,6 +37,7 @@ public class OrganisationDaoImpl extends DatabaseAccess<Organisation> implements
|
|||
if (criteria.getPublic() != null && criteria.getPublic()) {
|
||||
query.where((builder, root) -> builder.equal(root.join("dmps", JoinType.LEFT).get("status"), DMP.DMPStatus.FINALISED.getValue()));
|
||||
}
|
||||
}
|
||||
return query;
|
||||
}
|
||||
|
||||
|
|
|
@ -147,7 +147,7 @@ export class MainInfoComponent extends BaseComponent implements OnInit {
|
|||
}
|
||||
|
||||
filterOrganisations(value: string): Observable<ExternalSourceItemModel[]> {
|
||||
return this.organizationService.searchGeneralOrganisations({ criteria: { labelLike: value } });
|
||||
return this.organizationService.searchGeneralOrganisations({ criteria: { labelLike: value, like: value } });
|
||||
}
|
||||
|
||||
cantAddOrganizations(): boolean {
|
||||
|
|
Loading…
Reference in New Issue