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