【问题标题】:Grails: Offset and Max on many-to-many relationshipGrails:多对多关系的偏移和最大值
【发布时间】:2023-03-04 16:05:01
【问题描述】:

我关注两个具有多对多关系的域类

Question{
    has many 'Tag'
}

Tag{
    has many 'Question'
}

现在,我想每次使用 max 和 offset 属性只检索 3 个问题, 如何从控制器执行此操作?

【问题讨论】:

  • 太模糊了...向我们展示您正在使用的查询,它可以为您提供所有结果,我们也许可以提出改进建议。

标签: grails groovy grails-orm


【解决方案1】:
Question.list(max: YourMaxValue, offset: YourOffsetValue)

从标签中获取问题

Tag tag ..
tag.Question.list(max: YourMaxValue, offset: YourOffsetValue)

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-08-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多