Closed steve-anthony closed 9 years ago
Ton build ne passe pas…
No signature of method: bandstorm.service.BandService.getAllBandsByKeywords() is applicable for argument types: () values: []
Possible solutions: getAllBandsByKeywords(java.lang.String, java.lang.Integer, java.lang.Integer)
at bandstorm.service.BandServiceSpec.test getAllBandsByKeywords method(BandServiceSpec.groovy:15)
Ajouté dans le DaoService
/**
* Get all users corresponding to keywords
* @param keywords : a string input for the research
* @param maxItemsForSearch : max item for pagination
* @param page : value for the pagination
* @return a Map containing the list of Users and the total number of result
*/
Map getAllUsersByKeywords(String keywords,Integer maxItemsForSearch,Integer page){
Integer max = maxItemsForSearch*page+maxItemsForSearch
Integer offset =(maxItemsForSearch*page)
def resultsList = User.createCriteria().list {
or {
keywords.split(" ").each { keyword ->
ilike("username", "%" + keyword + "%")
ilike("firstName", "%" + keyword + "%")
ilike("lastName", "%" + keyword + "%")
}
}
maxResults(max)
firstResult(offset)
}
def resultsCount = User.createCriteria().count() {
or {
keywords.split(" ").each { keyword ->
ilike("username", "%" + keyword + "%")
ilike("firstName", "%" + keyword + "%")
ilike("lastName", "%" + keyword + "%")
}
}
}
def result = new HashMap()
result.totalOfUser = resultsCount.toInteger()
result.userList = resultsList.toList()
return result;
}
Recherche des utilisateurs Recherche des groupes