grails 可搜索插件按枚举类型排序
我有一个 PrintRequest 类,它具有一个名为“theStatus”的枚举类型(枚举类是 Status)属性,并且我希望可搜索以根据 PrintRequest 的 Status 进行排序。我已经在我的 PrintRequest 域类中创建了一个映射:
static mapping = {theStatus type:"integer"}
,但搜索方法仍然不执行任何排序。我这样调用搜索方法:
PrintRequest.search(queryString, [sort:aParams.sort, order:aParams.order, offset: aParams.offset, max:ApplicationHolder.application.config.printRequest.PrintRequest.defaultMax])
where aParams.sort = "theStatus" and aParams.order = "asc"
为什么可搜索不起作用?它返回与查询字符串匹配的 PrintRequest 列表,但它不会根据 Status 进行排序。
PrintRequest.groovy 看起来像
class PrintRequest {
static searchable = true
...
Status theStatus
...
static constraints = {
...
theStatus()
...
}
static mapping = {theStatus type:"integer"}
}
I have a class PrintRequest with a an enum type (enum class is Status) property called "theStatus" and I want searchable to sort based on theStatus of the PrintRequest. I've created a mapping:
static mapping = {theStatus type:"integer"}
in my PrintRequest domain class, but the search method still doesn't do any sorting. I call the search method like this:
PrintRequest.search(queryString, [sort:aParams.sort, order:aParams.order, offset: aParams.offset, max:ApplicationHolder.application.config.printRequest.PrintRequest.defaultMax])
where aParams.sort = "theStatus" and aParams.order = "asc"
Why isn't searchable working? It returns a list of PrintRequest that match the query string, but it doesn't sort based on theStatus.
PrintRequest.groovy looks like
class PrintRequest {
static searchable = true
...
Status theStatus
...
static constraints = {
...
theStatus()
...
}
static mapping = {theStatus type:"integer"}
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论