- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我有这个controller.method渲染与配置文件关联的所有东西,并且具有gsp中分页的正确偏移量和最大值
if (profil) {
def max = params.max ? params.max as int : 5
def offset = params.offset ? params.offset as int : 0
List things = []
things = Things.findAllByProfil(profil,[max: max, offset: offset, sort: 'dtCreated', order: 'desc'])
[profil: profil, things: things, thingsCount: things.size()]
}
if (profil) {
def max = params.max ? params.max as int : 5
def offset = params.offset ? params.offset as int : 0
List things = []
if(profil.typ == 'Aggregate'){
List profiles = profil.profiles?.collect { Profil.collection.findOne(_id:it.id) }
profiles.each() { pr ->
if(pr) {
things+= Things.findAllByProfil(pr as Profil,[max: max,offset: offset, sort: 'dtCreated', order: 'desc'])
}
}
things.sort{a,b-> b.dtCreated<=>a.dtCreated}
}else{
things = Things.findAllByProfil(profil,[max: max, offset: offset, sort: 'dtCreated', order: 'desc'])
}
[profil: profil, things: things, thingsCount: things.size()]
}
offset
和
max
,因此结果列表太大。
assert params.max == 5 && profil.typ == "Aggregate"
,第一页的结果是一个列表,其中包含所有配置文件的5个最新内容(因为我将它们全部放在列表中并按dtCreated排序),而我问题可能是:如何对聚合列表应用相同的 slice 逻辑(以及如何以高效的方式聚合事物)
最佳答案
首先,我想对rcgeorge23所说的内容进行扩展,您最好让gorm /数据库处理您的聚合。 Section 6 of the Grails documentation将带您走很长一段路。
在您的特定情况下,您可以将简单的内置比较器与您的`findAllBy'一起使用来处理聚合,这是一个具体示例:
if(profil.typ == 'Aggregate'){
List profiles = //some code to get a list of profiles
def things = Things.findAllByProfilInList(profiles, [max: max....order: 'desc'])
} else {
...
}
def thingsCount = Things.countByProfilInList(profiles) //for all things with aProfile in list
or
def thingsCount = Things.countByProfil(aProfile) //for all things with aProfile
关于grails - 使用迭代gorm查询聚集进行分页,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17260580/
我想沿着一个轴从特定位置的X数组中分散并收集元素。 因此,给定一个索引数组idx,我想选择第0列的idx(0) th元素,第1列的idx(1) th元素,等等。 在Numpy中,以下语句: X = n
我有一个在集群硬件中运行的 Java 应用程序。我使用 Hashmap 作为缓存。我也希望缓存能够集群。有没有一些开源java项目可以在两台连接的机器上同步Hashmap? 最佳答案 看看 Hazel
这个问题在这里已经有了答案: Count number of times that an item occurred in each of multiple columns (4 个答案) 关闭 5
我一直在尝试“组合”一个列表 I mean putting items together depending on the item inbetween, so ['d','-','g','p','q
非聚集文件存储在数据文件中,聚集索引按逻辑索引顺序存储数据。 逻辑顺序位于哪里? 最佳答案 大多数 MySQL 索引的结构为 BTree。 (参见维基百科) (我在此讨论中排除了 FULLTEXT 和
所有源和目标都位于不可缓存的内存中。毫无疑问。在启动 DMA(即分散-聚集 DMA)之前,我构建了 DMA 链表(包含 src、dest、size 和 next)。我想我不必将列表放入不可缓存的内存中
我需要将输入字符串拆分为输出字符串(按一定顺序)通过在输入字符串上应用一组正则表达式。我想实现这个功能与 akka Actor 集群一起使用,我将其分散正则表达式和输入字符串并收集字符串。不过我想知道
Windows 文件系统支持scatter/gather IO .(当然,其他平台也可以) 但是不知道什么时候用IO机制。 你能给我解释一个合适的案例吗? 使用I/O机制我们能得到什么好处?(只是一点
我正在尝试使用克隆调用两个端点并收集它们的信息以通过聚合发送,我必须将其与分散收集中介器一起使用。每个端点返回一个 json 字符串。但我一直遇到“期望 SOAP Envelope 的实现作为父级”错
我想要实现的目标是使用户空间中的内存块可以通过 PCIe 直接由 FPGA 板中的 DMA 内核访问(不受内核的任何干扰)。 为此,我在用户空间中使用 posix_memalign() 在用户空间中分
假设我有以下数据框: > a a Source: local data frame [3 x 2] my_type_1_num_widgets my_type_2_num_widgets 1
我已经搜索了一段时间,但似乎无法在文档或 SO 上找到任何有用的信息。 This question并没有真正帮助我,因为它引用了修改程序集,而我正在用 C 语言编写。 我有一些代码进行间接访问,我想对
我已经坚持了一段时间了。我的代码基于 https://webrtc.org/getting-started/firebase-rtc-codelab .我基本上只是将其更改为 React 和 fire
我可以合并 Mono> 的列表吗?数据源整合为单个Mono>包含所有项目而不阻塞? 在我的带有 Lombok 分散收集应用程序的 JDK 9 Spring Boot 2 中,此阻塞版本有效:
我是一名优秀的程序员,十分优秀!